I created an application that uses Parse.com push request alerts. I have a settings page where you can enable / disable push notifications. The settings page works well, it changes the preference used, but push notifications do not stop.
Here is my code where I subscribe / unsubscribe:
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); pushNotificationsPreference = sharedPrefs.getBoolean("PUSH_NOTIFICATION_PREFERENCE", true); if (pushNotificationsPreference) { ParsePush.subscribeInBackground("Android", new SaveCallback() { @Override public void done(ParseException e) { if (e != null) { Log.d("com.parse.push", "successfully subscribed to the broadcast channel."); } else { Log.e("com.parse.push", "failed to subscribe for push" + e); } } }); } else { ParsePush.unsubscribeInBackground("Android", new SaveCallback() { @Override public void done(ParseException e) { if (e != null) { Log.d("com.parse.push", "successfully subscribed to the broadcast channel."); } else { Log.e("com.parse.push", "failed to unsubscribe for push" + e); } } }); }
If "pushNotificationsPreference" is false, it calls the method "ParsePush.unsubscribeInBackground" ("Android", the new SaveCallback () ", but it will not subscribe, I still get them.
I went to Parse.com and I am only registered on the "Android" channel.
Am I missing something?
Vlad Iancu
source share