我是新来的Android和我一直在努力表现出抬起头动作推送通知,就像WhatsApp的一样。
这是我为我的通知配置:
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, ADMIN_CHANNEL)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_foreground))
.setSmallIcon(R.drawable.m_icon)
.setContentTitle(remoteMessage.getNotification().getTitle())
.setTicker(remoteMessage.getNotification().getBody())
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.mblue))
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(remoteMessage.getNotification().getBody()))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(likePendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0,notificationBuilder.build());
我曾经在一些后阅读的关键acomplish这是高优先级设置为通知,但它仍然不是为我工作。