My app icon is blue/red and when I receive a push notification the icon on status bar is the same app icon(blue/red). I want the icon of the status bar be a transparent and white version.
My ionic project is using this cordova plugin to receive push notifications. The official docs of the plugin theres nothing about how to configure the icon of the status bar notification.
Looks like what you’d want isn’t possible with that library.
On iOS
According to the documentation, the notification icon is automatically set to your app’s small icon (Icon-Small.png
):
In the banner, iOS displays your notification message and the small version of your app icon.
Unless you change the small version of the app icon, this is not possible at all on iOS.
On Android
Using the Android APIs this would be simple with Notification.Builder#setSmallIcon(int)
, but the library you’re using hard-codes that icon to the application’s icon.
You’d need to modify the library to accept other icons. It’s likely that this has not been implemented so that the behaviour would be consistent on all platforms.
UPDATE
Now with this plugin is completely possible.
private void shownotification(String message, Context context) {
NotificationManager mNotificationManager = (NotificationManager) context
.getSystemService(context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mNotifyBuilder = new NotificationCompat.Builder(
context).setContentTitle("Jaswinderwadali").setContentText(message)
.setDefaults(Notification.DEFAULT_ALL).setAutoCancel(true)
.setSmallIcon(R.drawable.Mypic);
Notification notification = mNotifyBuilder.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(0, notification);
}
Its For android change icon of notification in status bar .setSmallIcon(R.drawable.Mypic)
You need to create a icon named ic_stat_onesignal_default in your drawables directory which will be shown instead of OneSignal's default bell icon.