Created
July 2, 2013 19:52
-
-
Save rnystrom/5912541 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // get user settings | |
| SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); | |
| boolean doUpdates = sharedPref.getBoolean(SettingsActivity.UPDATES_KEY, true); | |
| boolean doRally = sharedPref.getBoolean(SettingsActivity.RALLY_KEY, true); | |
| boolean doLeads = sharedPref.getBoolean(SettingsActivity.LEAD_KEY, true); | |
| // subscribe to channels based on user settings | |
| if (doUpdates) PushService.subscribe(this, Update.UPDATES_NOTIFICATION_KEY, UpdatesDetail.class); | |
| if (doRally) PushService.subscribe(this, Update.RALLY_NOTIFICATION_KEY, UpdatesDetail.class); | |
| if (doLeads) PushService.subscribe(this, Update.LEAD_NOTIFICATION_KEY, UpdatesDetail.class); | |
| // channel for special users | |
| if (ParseUser.getCurrentUser() != null && ParseUser.getCurrentUser().getBoolean(NJUser.IS_P2P_KEY)) { | |
| PushService.subscribe(this, "p2p", MainActivity.class); | |
| } | |
| // channel for development & testing | |
| PushService.subscribe(this, "development", MainActivity.class); | |
| // default activity for push callback | |
| PushService.setDefaultPushCallback(this, MainActivity.class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment