@Override protected void onDeletedMessages(Context context, int total) { String message = "message deleted " + total; CommonUtilities.displayMessage(context, message); // notifies user generateNotification(context, message); }
@Override protected void onUnregistered(Context context, String registrationId) { // Log.i(TAG, "Device unregistered"); CommonUtilities.displayMessage(context, "Device Unregistered"); if (GCMRegistrar.isRegisteredOnServer(context)) { } else { // This callback results from the call to unregister made on // ServerUtilities when the registration to the server failed. // Log.i(TAG, "Ignoring unregister callback"); } }
@Override protected void onMessage(Context context, Intent intent) { // Log.i(TAG, "Received message"); // String message = getString(R.string.gcm_message); AppLog.Log(Const.TAG, intent.getExtras() + ""); String message = intent.getExtras().getString("message"); String team = intent.getExtras().getString("team"); AppLog.Log("Notificaton", message); AppLog.Log("Team", team); String title = intent.getExtras().getString("title"); Intent pushIntent = new Intent(Const.INTENT_WALKER_STATUS); pushIntent.putExtra(Const.EXTRA_WALKER_STATUS, team); CommonUtilities.displayMessage(context, message); // notifies user generateNotification(context, message); LocalBroadcastManager.getInstance(context).sendBroadcast(pushIntent); }
@Override protected void onRegistered(Context context, String registrationId) { // Log.i(TAG, "Device registered: regId = " + registrationId); CommonUtilities.displayMessage(context, "Device Registerd"); // SSConstanants.DEVICE_TOKEN=registrationId; // Create object of SharedPreferences. new PreferenceHelper(context).putDeviceToken(registrationId); // System.out.println(registrationId + "========>>>>>>"); AppLog.Log(Const.TAG, registrationId); publishResults(registrationId, Activity.RESULT_OK); // GCMRegisterHendler.onRegComplete(registrationId); /** * *********************** ParseObject pObj = new ParseObject("PushNoti"); * pObj.put("DeviceToken",registrationId); pObj.put("InRange",true); * pObj.put("DeviceType","android"); //pObj.put("ACL",""); pObj.saveInBackground(); * displayMessage(context, getString(R.string.gcm_registered)); // * ServerUtilities.register(context, registrationId); */ }