Java Code Examples for com.google.android.gcm.GCMRegistrar#isRegisteredOnServer()

The following examples show how to use com.google.android.gcm.GCMRegistrar#isRegisteredOnServer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GCMIntentService.java    From ownmdm with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onUnregistered(Context context, String registrationId) {
    Util.logDebug("Device unregistered");
    if (GCMRegistrar.isRegisteredOnServer(context)) {
        ServerUtilities.unregister(context, registrationId);
    } else {
        // This callback results from the call to unregister made on
        // ServerUtilities when the registration to the server failed.
        Util.logDebug("Ignoring unregister callback");
    }
    
}
 
Example 2
Source File: AppServices.java    From apigee-android-sdk with Apache License 2.0 5 votes vote down vote up
static void registerPush(Context context) {

    final String regId = GCMRegistrar.getRegistrationId(context);

    if ("".equals(regId)) {
      GCMRegistrar.register(context, Settings.GCM_SENDER_ID);
    } else {
      if (GCMRegistrar.isRegisteredOnServer(context)) {
        Log.i(TAG, "Already registered with GCM");
      } else {
        AppServices.register(context, regId);
      }
    }
  }
 
Example 3
Source File: Client.java    From apigee-android-sdk with Apache License 2.0 5 votes vote down vote up
public void registerPush(Context context) {
    final String regId = GCMRegistrar.getRegistrationId(context);
    if ("".equals(regId)) {
        GCMRegistrar.register(context, GCM_SENDER_ID);
    } else {
        if (GCMRegistrar.isRegisteredOnServer(context)) {
            Log.i(TAG, "Already registered with GCM");
        } else {
            this.registerPush(context, regId);
        }
    }
}