我有一個應用程序應該顯示頭像通知,而應用程序在前臺和後臺(不在歷史中)。如何使用Firebase Cloud Messaging(Notification)在android中使用Heads Up通知,而應用程序不在前臺?
在前景的情況下,我通過以下方法實現了這一點。
PendingIntent pendingIntent = PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
builder.setFullScreenIntent(pendingIntent,true);
但在後臺,它總是在通知顯示area.Can有人告訴如何達致這在後臺(而不是在歷史上)
我嘗試了通知,但不工作的下面的參數。
{
"to" : "_Token_",
"priority":"high",
"data":
{
"title": "Test",
"text": "Fcm"
},
"notification":
{
"title": "Test",
"text": "Fcm"
}
}
嗨。通過「*背景(不在歷史中)*」,你的意思是應用程序*被殺害*? –