I use GCM in my application I want when I receive notification the number in badge increment I'm using this library
implementation "me.leolin:ShortcutBadger:1.1.21@aar"
in the receive I implemented this code in onMessageReceived
:
PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri1 = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(appGCMModel.getGcmTitle())
.setContentText(appGCMModel.getGcmMessage())
.setAutoCancel(true)
.setSound(defaultSoundUri1)
.setContentIntent(pendingIntent2)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(appGCMModel.getGcmMessage()));
Notification notification = notificationBuilder.build();
ShortcutBadger.applyNotification(getApplicationContext(), notification, i);
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notification);
but when the notification is received the number of badge isn't incremented can any one help me?