This question brought up an interesting issue.
The OP has an app that displays a map, and this map needs to be updated with location markers that are received via SMS messages. The individual steps are fairly straightforward: the SMS messages can be received by a BroadcastReceiver
, the markers can be displayed by an ItemizedOverlay
on top of a MapView
. The tricky part is to have the receiving part communicate with the main part of the app.
What happens if the app has an active
MapActivity
, and then itsBroadcastReceiver
is invoked as a response to an incoming SMS? Is theMapActivity
suspended while theBroadcastReceiver
code is executed in the same process? If so, is it safe forBroadcastReceiver
to access theMapActivity
via a static reference (which is set by the activity'sonCreate
method?Conversely, is an app's
BroadcastReceiver
executed in a separate process, and would therefore need some other way to communicate with the app's activty?