Broadcastreceiver Fires After The Activity Is Already Created
I want to use a BroadcastReceiver to get permission to communicate with a USB device. I am trying to implement it the same way it is done on android website http://developer.androi
Solution 1:
You're registering your broadcast receiver in you activity. That means that before you run that activity, you cannot receive broadcasts.
You should probably look at registering a reciever-tag in in you AndroidManifest.xml. This is the docs for the receiver-tag. This allows you to register receivers without starting your activity.
This part is important:
The <application> element has its own enabled attribute that applies to all application components, including broadcast receivers. The <application> and <receiver> attributes must both be "true" for the broadcast receiver to be enabled. If either is "false", it is disabled; it cannot be instantiated.
Post a Comment for "Broadcastreceiver Fires After The Activity Is Already Created"