/** @param context current context */ public void onStartup(Context context, boolean registerAppOpen) { // check for manifest and permissions pushRegistrar.checkDevice(context); if (registerAppOpen) sendAppOpen(context); final String regId = GCMRegistrar.getRegistrationId(context); if (regId.equals("")) { // Automatically registers application on startup. pushRegistrar.registerPW(context); } else { if (context instanceof Activity) { if (((Activity) context).getIntent().hasExtra(PushManager.PUSH_RECEIVE_EVENT)) { // if this method calls because of push message, we don't need to register return; } } // if we need to re-register on Pushwoosh because of Pushwoosh App Id change if (forceRegister) { registerOnPushWoosh(context, regId); } else { if (neededToRequestPushWooshServer(context)) { registerOnPushWoosh(context, regId); } else { PushEventsTransmitter.onRegistered(context, regId); } } } }
public void unregister() { cancelPrevRegisterTask(); pushRegistrar.unregisterPW(mContext); }