I need to send a context as part of a SendBroadcast()
call. Is this Possible? I have searched but cannot seem to find a solution.
I need to broadcast to a service running under system server to display an alert dialog. when I use the context from system server I get the following exception:
E/AndroidRuntime( 2049): Caused by: android.view.WindowManager$BadTokenExceptio开发者_如何学Cn: Unable to add window -- token null is not for an application
No this is not possible. But the receiver of the broadcast should have its own context that you can use.
Why do you want to send a Context?
EDIT A service cannot display a Dialog. A Service can post i.e. a notification to the status bar or you can start one of your activities.
精彩评论