2
我已經在我的應用程序中使用volley庫創建了通知,它調用了Firebase服務器我的問題是當我在特定用戶(設備)中推送通知時僅顯示更新通知並且未讀通知計數編號未顯示,所以我想要讀取通知計數編號如何在我的應用程序圖標中顯示。幫助我..我想在我的應用程序圖標上顯示未讀的通知數量,如whatsapp
My code is:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG="MyMessageservice";
RemoteMessage remoteMessage;
@Override
public void onMessageReceived(RemoteMessage remoteMessage){
String title=remoteMessage.getNotification().getTitle();
String message=remoteMessage.getNotification().getBody();
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// String click_action=remoteMessage.getNotification().getClickAction();
Intent intent=new Intent(this,VisitorList.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
Uri notificattionSound= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationbuilder = new NotificationCompat.Builder(this);
notificationbuilder.setContentTitle(title);
notificationbuilder.setContentText(message);
notificationbuilder.setAutoCancel(true);
notificationbuilder.setSound(notificattionSound);
notificationbuilder.setSmallIcon(R.drawable.ic_launcher);
notificationbuilder.setContentIntent(pendingIntent);
notificationbuilder.setAutoCancel(true);
notificationManager.notify(0, notificationbuilder.build());
}
}
我覺得這個功能需要ROM支持。 AOSP不支持圖標角落的數字。 –
怎麼..?Rom和AOSP的意思..? – Anbu
我認爲您要查找的術語「*未讀通知計數編號*」是*徽章*計數。 –