Android PendingIntent howto
Ok I am stuck. Can someone please point me in the right direction? I have no idea where to start with pendingintents. I need to start custom service that sends some dat开发者_JAVA百科a back to the activity that started it. How would I do that?
I would probably register a Broadcast Receiver in my Activity and if I needed to communicate from Service to Activity, send a broadcast from the Service and the Activity's receiver would pick it up as long as the Activity was currently running. This, by the way, would not require the use of a PendingIntent. PendingIntents are more used with alarms from the AlarmManager or with Notifications.
You should consider using AsyncTask if you expect your Activity to be active (visible) all the time the Service runs.
精彩评论