java - Register broadcast receiver via Application context -
my application class handles current activity's context , other stuff (like showing toast, dialogues , that). other thing, i'm using application class, registering broadcast receivers. not via activity's context, application's. want know is: broadcast receiver block ui (activity's) thread? (i'm calling receiver via application, make difference?) also, there's option can register receiver via handler (from application context). should that? or there other approach available, won't block main thread? thank you.
broadcastreceiveronreceive()
called within main thread of process, unless explicitly asked scheduled on different thread using [registerreceiver(broadcastreceiver, intentfilter, string, android.os.handler)
](https://developer.android.com/reference/android/content/context.html#registerreceiver(android.content.broadcastreceiver, android.content.intentfilter, java.lang.string, android.os.handler)).
when runs on main thread should never perform long-running operations in (there timeout of 10 seconds system allows before considering receiver blocked , candidate killed). cannot launch popup dialog in implementation of onreceive()
.
Comments
Post a Comment