Reputation: 5430
In manifest in application tag I have:
<receiver
android:name=".MyC2dmReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE" />
<category
android:name="com.my.app" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category
android:name="com.my.app" />
</intent-filter>
</receiver>
And my receiving has sth like that
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) {
handleRegistration(context, intent);
} else if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) {
handleMessage(context, intent);
}
}
When my app is on or in background onReceive
method is fired, but when I kill app using AdvancedTaskKiller onRecived
stops receiving. Why?
Why Android doesn't start my receiver? Do I need sth in manifest?
Upvotes: 2
Views: 768
Reputation: 1007524
Why?
If you are on Android 3.1 or newer, it is because your application has been moved into the stopped state. This also occurs if the user force-stops you via the Settings application. Until the user manually launches your app again (e.g., taps on an icon in the launcher), none of your BroadcastReceivers
will work.
Upvotes: 1