Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Register #16

Closed
tasomaniac opened this Issue · 4 comments

2 participants

Said Tahsin Dane Mike Willbanks
Said Tahsin Dane

How do I register and unregister my users from Android Application.
This sends GCM messages successfully using registrationIDs. How can I update my users registrationIDs?

Mike Willbanks
Owner

Please take a look at google's getting started guide; you will be able to see the android application portion of this:
http://developer.android.com/guide/google/gcm/gs.html#android-app

In terms of registration id's and getting updates, after sending there is a response object. You can call getResults() which will return a multi-dimensional array that contains a key of registration_id. This means you will need to update the registration id.

In terms of the application and updates; you check this on the launch of the app which is explained in the getting started guide above.

Said Tahsin Dane
Mike Willbanks
Owner

Yes we send ours to a web services;
In step 3 you will note there is a GCMBaseIntentService which you will override the following methods:

  • onRegistered
  • onUnregistered
public class GCMIntentService extends GCMBaseIntentService {

    public GCMIntentService() {
        super(Constants.SENDER_ID);
    }

    @Override
    protected void onRegistered(Context context, String regId) {
        // write a call here to send the regId to your server and unregister it
    }

    @Override
    protected void onUnregistered(Context context, String regId) {
        // write a call here to send the regId to your server and unregister it
    }

If you have the GCM package from android you can look inside of the sample application at: /path/to/android-sdk/extras/google/gcm/samples/gcm-demo-client/src/com/google/android/gcm/demo/app/GCMIntentService.java

Inside of the ServerUtilities.java file located at: /path/to/android-sdk/extras/google/gcm/samples/gcm-demo-client/src/com/google/android/gcm/demo/app/ServerUtilities.java you will find a post method that shows you a sample of making the HTTP request.

Said Tahsin Dane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.