开发者

Android - Monitoring for keyPress on Service

开发者 https://www.devze.com 2023-02-08 16:42 出处:网络
I have just integrated开发者_运维问答 services into my android app - I am also using startForeground because it\'s a critical app.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号