I have created a broadcast receiver statically by specifying it within the Manifest, and I have also created the "same" broadcast receiver in code and have registered it with the application context. The static way works very well, but the dynamic way does not receive the expected broadcast. It could be that I am not creating the intent filter correctly, or that I need to register it with some other context somewhere. Please see the code examples to see what I am doing. This is related to receiving data SMS, it works very well on a device using a broadcast receiver defined in the Manifest. The correct permissions are set for both examples.
The following is from the Manifest, and the resulting receiver gets the expected broadcasts: <receiver android:name=".MyReceiver"> <intent-filter> <action android:name="android.intent.action.DATA_SMS_RECEIVED" /> <data android:scheme="sms" android:host="localhost" android:port="6432"/> </intent-filter> </receiver> The following is the code example that doesn't work (it does work with an intent like "android.provider.Telephony.SMS_RECEIVED" but not for data sms): MyReceiver mReceiver = new MyReceiver(); IntentFilter mFilter = new IntentFilter ("android.intent.action.DATA_SMS_RECEIVER"); //also tried an empty filter intentFilter.addDataAuthority("localhost", "6432"); intentFilter.addDataScheme("sms"); context.registerReceiver(mReceiver, mFilter); The question is - why does this broadcast receiver get notified of the incoming data messages? It seems some other resource is notified when the Manifest version of the receiver is created... Thank you, Squib --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---