5

I've got a problem with receiving push messages after I forcefully closed the application (to simulate).

Now if I send push messages I get in adb:

GCM-DMM : broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=THE_PACKAGE_NAME (has extras) }

This is coming from the com.google.android.gms.persistent service

I've tried to create a adb command to debug it manually but still it doesn't work

adb shell am broadcast -a com.google.android.c2dm.intent.RECEIVE -c THE_PACKAGE_NAME

Results:

Broadcasting: Intent { act=com.google.android.c2dm.intent.RECEIVE cat=[THE_PACKAGE_NAME] }
Broadcast completed: result=0

I guess this failes with result=0

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="THE_PACKAGE_NAME">

        ......
    <application android:label="@string/app_name"
                android:theme="@style/AlmanappTheme"
                android:icon="@drawable/ic_launcher"
                android:name="AppController">
        ....
             <!-- [START firebase_service] -->
        <service
            android:exported="true"
            android:name=".push.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
        <!-- [END firebase_service] -->
        <!-- [START firebase_iid_service] -->
        <service
            android:name=".push.MyFirebaseInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>
        <!-- [END firebase_iid_service] -->

        ....

I'm currently a bit clueless where to look.

Maybe I need to add a <receiver or is there some magic way i've looked over? Because I can't imagine there is no way to not receive new messages

Some possible idea's:

  • Start service on boot
  • Set timer for periodically loading of new messages
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Spidfire
  • 5,433
  • 6
  • 28
  • 36
  • 1
    Check this link: http://stackoverflow.com/questions/37357745/is-there-a-way-to-receive-a-gcm-message-even-if-the-app-is-close-closed-by-slid/37429495#37429495 – abielita Jun 28 '16 at 08:13

0 Answers0