Small icons appear in the Android notification bar and allow users to recognize your app when they receive a notification. Before releasing a new version of your app on the Store, you should make sure you've set a custom small icon for your notifications.
In order to set it up with Batch Push, you have to do three things:
res folder in
Plugins\Android and put your small icon drawables there, for all screen densities. Your projet folder architecture should look like that:
Plugins └─── Android ├── AndroidManifest.xml ├── Batch ├── google-play-services_lib └── res ├── drawable-hdpi │ └── ic_notification_icon.png ├── drawable-mdpi │ └── ic_notification_icon.png ├── drawable-xhdpi │ └── ic_notification_icon.png └── drawable-xxhdpi └── ic_notification_icon.png
Add the following in your manifests'
<meta-data android:name="com.batch.android.push.smallicon" android:resource="@drawable/ic_notification_icon" />
Your notifications will now automatically use that icon. Please note that you are not forced to use
ic_notification_icon for the icon's name. The name in the manifest simply needs to match the filenames.
For your Android 5.0 users (and newer), you should set a color to your notification, which will be shown behind the small icon. Simply add this in your manifest, just like the small icon metadata:
<meta-data android:name="com.batch.android.push.color" android:value="#FF00FF00" />
You can also use
android:resource instead of
android:value and point to a color defined in an XML ressource file.
You can restrict notification display on Android with several parameters such as disabling sound, vibration, or simply disabling notifications for that user if you have a way to ask for opt-in.
Batch Push provides you with an enum with the interactions a notification can have via: PushNotificationType. This enum contains ALERT, SOUND, LIGHTS and VIBRATE. By default, everything is activated.
BatchPlugin.Push.AndroidNotificationType = AndroidNotificationType.None;
Batch.Push.setNotificationsType whenever you want in the runtime of your application.
BatchPlugin.Push.AndroidNotificationTypes = AndroidNotificationType.Alert | AndroidNotificationType.Lights | AndroidNotificationType.Vibrate;
Please keep in mind that once you've set notification type within Batch, you have to set it again to change it.