julius wrote: >> Furthermore, a BroadcastReceiver has no good way of communicating to a >> running activity, let alone determining if there is one there. > Yeah I was kinda having trouble with this part... :) > > >> Now, if you take the BroadcastReceiver out of the equation, your >> dialog-raising Activity could register itself with the service (e.g., >> bindService(), then call some API offered by the service). When the >> service wishes to notify the user, it checks to see if a listener is >> registered. If so, it calls a method on that listener, which triggers >> the activity to display the dialog. If there is no listener, the service >> raises the notification. Just be sure to unregister the listener as the >> activity exits. > This sounds excellent. > > I was using a BroadcastReceiver as the Service has ProximityAlerts set > up , each of which expects a PendingIntent. I had each PendingIntent > send a broadcast. I guess I'll need to use PendingIntent.getService() > to start the process of notification or call method on the listener.
If you use a BroadcastReceiver registered via registerReceiver(), your PendingIntent/ProximityAlert stuff should work and you can still tie back into the activity. However, that has the side-effect of forcing your service to stay in memory all the time, which may or may not be a good thing, depending on your app. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

