Sounds and Notification Icons
The Push IO Manager will play any sound included in the GCM payload, so long as the sound you're playing is in res/raw folder of your project. Work with your marketing team to define the sounds they can use when they create their push notifications in Responsys.
Note: Unlike iOS, payloads that contain sound for Android do not need the filetype (.wav or .caf, etc.) to be present in the payload. For example, a sound file "timeralarm.wav" will only need a payload of "sound":"timeralarm" to play on your Android device.
Notification Icons
For Android, you can set two types of default notification icons (Android 3.0+). Place the icon files in the drawable
folder, which is located in your resources (res
) folder:
- The Small Icon is the icon displayed in the Status Bar. The syntax for setting it is as follows, where
small_icon_name
is the name of the icon file placed in thedrawable
folder.
PushIOManager.getInstance(this).setDefaultSmallIcon(R.drawable.small_icon_name);
- The Large Icon is the icon displayed when you pull down the Notification Drawer. The syntax for setting it is as follows, where
large_icon_name
is the name of the icon file. The icon file is placed in thedrawable
folder.
PushIOManager.getInstance(this).setDefaultLargeIcon(R.drawable.large_icon_name);
Example of setting the notification icons: In the following example calls, both setDefaultLargeIcon()
and setDefaultSmallIcon()
take an Integer value as the parameter.
PushIOManager.getInstance(this).setDefaultSmallIcon(R.drawable.emo_im_surprised);
PushIOManager.getInstance(this).setDefaultLargeIcon(R.drawable.emo_im_happy);
The Integer value must be a resource ID generated by the build system. In the calls above, the icon name represents the Integer value. For example,
R.drawable.emo_im_surprised
is the Integer value of the iconemo_im_surprised.png
that has been placed in thedrawable
folder.The build system generates the resource ID after you have placed the icon/image in the
src/main/res/drawable-
xxxx
folder, wherexxxx
represents the target screen density. (For more information about target screen density qualifiers, see the Supporting Multiple Screens topic in the Android Developers Guide.)You can learn more about notification patterns and icon style in the Google Material Design guide.
Icon Color
With the release of SDK v6.51, there is a new API that enables you to change the small notification icon color.
PushIOManager.getInstance(this).setNotificationSmallIconColor(Color.RED);
The parameter is an integer data type (see Color ints for more information).