Notification Preferences allow your users to make choices about the kind of push notifications they want to receive. Push notifications show up even when a user isn’t interacting with your app, so if the messages aren’t relevant your users will opt-out. Instead of turning off all notifications, users can choose ones they value. For example, a user may choose to receive notifications about score updates for his or her favorite sports team and opt out of other teams' updates.
Before you begin: Work with your marketing team to define which Notification Preferences to offer in your app, as described in the Design Mobile Apps for Responsys topic. For example, the preference for a favorite team may contain a concise name or abbreviation for that team. Another preference could denote whether a user wishes to receive news updates. A third preference could be used to inform when ticket sale prices have dropped to a specified threshold.
You may have as many as 30 preferences. Notification Preferences have 3 declaration fields:
Valid key names for preferences may only contain alphanumeric characters and underscores, and must be between 1 and 25 characters in length. Key names are case-sensitive. Use unique, uppercase names for the preference key names. Responsys treats the preference key names as all uppercase.
Human-readable labels for your application to display. All unicode characters are valid for these labels, but they must be between 1 and 1024 characters in length.
BOOLEAN, STRING, or NUMBER. Coordinate with the Responsys Account Admin regarding preferenceType (BOOLEAN, STRING, or NUMBER), so that the Responsys Account Admin can set up the correct data mapping in Responsys for the preferences fields.
Coding the Notification Preferences
Once you have decided upon your Notification Preferences for your app, you'll first need to declare them, then set default values for them using the PushIO SDK, per the sections below. Later, you'll want to create a user interface in your app to let the user modify their preferences.
How and what you display is up to you and the preferences you've defined. For example, you can tie a Boolean type Notification Preference to a UISwitch:
After declaring Notification Preferences, you'll want to set values for these preferences. You might do this to set default preference values after the user's device is registered for the first time or when the user wishes to make changes to his or her preferences.
Declare the preferences before setting them, because setting preferences without declaring them first is ignored.