开发者

Interaction of Activity, Service and Notification

开发者 https://www.devze.com 2023-02-19 17:43 出处:网络
I want to start a service that uploads some data to a web page. The service sends notifications to the notification bar (updates a progress bar). So far so good.

I want to start a service that uploads some data to a web page. The service sends notifications to the notification bar (updates a progress bar). So far so good. Now, I want to show a activity when the user clicks on the notification in the notification bar. This Activity shall contain a button and optionally a status of the upload, i.e. I have to access the service that uploads the data. Is there a correct way to handle this requirement?

The service is currently started from a activity. I guess the main problem here is, to "link" the activity th开发者_开发知识库at is started from the pendingIntent on in the Notification with the service, i.e. access the service information. Does someone have a good example for that use case/issue?


Just bind the activity to the service. Hope this, and this and this helps you out

0

精彩评论

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