Android - Monitoring for keyPress on Service
I have just integrated开发者_运维问答 services into my android app - I am also using startForeground because it's a critical app.
So, my question is - how do I get it to revert the user to the application when they have done a keyPress on the notification / service in their Notification Panel. I have looked everywhere for this and can't find it anywhere...There isn't much point in using services if they don't get directed back to the app onKeyPress so really need to get this working.
Any help is much appreciated.
Thanks
So, my question is - how do I get it to revert the user to the application when they have done a keyPress on the notification / service in their Notification Panel.
If the user clicks on the entry in the notification panel (via touchscreen or D-pad), the PendingIntent
you supplied via setLatestEventInfo()
will be executed. Use an appropriate PendingIntent
to bring up the activity you seek. Here is a sample application demonstrating this.
精彩评论