Saturday, 24 August 2013

Android - BroadcastReceiver doesn't receive custom intent

Android - BroadcastReceiver doesn't receive custom intent

I have:
MyApp extends Application with onCreate:
sendBroadcast(refreshAlarm);
Log.d(TAG, "broadcast sent with intent " + refreshAlarm);
Log.d(TAG, "onCreate");
where
static final Intent refreshAlarm = new Intent(ACTION_REFRESH_RECEIVER);
public static final String ACTION_REFRESH_RECEIVER =
"com.example.myapp.REFRESH_RECEIVER";
BroadcastReceiver with on Receive:
Log.d(TAG, "broadcast received with intent " + intent);
// do some work here
declared in manifes:
<receiver android:name="com.example.myapp.RefreshReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="com.example.myapp.REFRESH_RECEIVER" />
</intent-filter>
</receiver>
It seems to me that I have all I need to make this work. Broadcast is send
in onCreate (I can see in log it is indeed send). Broadcast is declared
with intent filter to receive refreshAlarm intent, but it doesn't receive
it and I cannot figure out why. Do I need anything else?

No comments:

Post a Comment