0

I am trying to do something that I am not sure is possible or not . I have created my android application "ABC" . I have used GCM to issue notifications from my 3rd party service.

Now my client asks that he wants a history of all notifications issued by the 3rd party server . I am sceptical about this .

I believe I might be able to show a list of all notifications issued by the server WHICH ARE RESPONDED upon by the user . However I think the notifications on which the user has not responded cannot be recorded by my application .

Is this true ?

I have this broadcast receiver in my code that responds to GCM messages.

<receiver
            android:name="com.mob.uae.notifications.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <category android:name="com.evento.uae" />
            </intent-filter>
        </receiver>

Shouldn't this be called regardless of the user's action upon the notification ? . If this is called even when my application is shut down , then I think we do have a way to record all notifications targeted for me .

Any idea geniuses ?

Muhammad Ahmed AbuTalib
  • 4,080
  • 4
  • 36
  • 59

1 Answers1

0

The broadcast receiver is activated every time a GCM message reaches the device, regardless of the user's action. Therefore, if you wish to record the message locally on each device, you can do it.

You can even record it in the server side, if the code in the broadcast receiver would trigger a call to your server to notify it that the message was received by the app (in this case it would be better to start an intent service from the receiver, and let the service do the communication with the server).

Eran
  • 387,369
  • 54
  • 702
  • 768
  • That means that the GCM broadcast receiver I have implemented in my code , will invoke upon the broadcast regardless of whether of my application is shutdown or not correct ? – Muhammad Ahmed AbuTalib Jun 29 '14 at 10:23
  • @MuhammadAhmedAbuTalib That's correct. The only exception is that if the application is force closed by the user, it will stop getting GCM messages until it is manually started again by the user. – Eran Jun 29 '14 at 10:34
  • Eran . What would you mean by force close ? . The only concern I have is that my application is not at all on the history stack even . For example the cellphone has been restarted and currently no applications run in the background. In such the case , will I still be able to receive GCM ? – Muhammad Ahmed AbuTalib Jun 29 '14 at 10:42
  • 1
    @MuhammadAhmedAbuTalib I meant force-stopping the app from the Android device settings. IF you stop the app this way, GCM messages wouldn't reach the app. Restarting the phone doesn't force-stop the applications, so you should continue receiving GCM messages. You can read more about it [here](http://stackoverflow.com/questions/20838415/gcm-push-notification-works-after-app-force-stop). – Eran Jun 29 '14 at 12:05