3

我正在開發Android和iOS應用程序,並且我正在使用PushSharp(在服務器端)向兩個平臺發送推送通知。特別是我正在使用(for Android)Firebase平臺(FCM)。PushSharp Google Cloud Messaging單元通知

正在關注this指南我能夠將推送通知發送到Android設備設置圖標和聲音,但我認爲存在問題。 當通知到達時,它不會顯示爲擡頭通知,而只會顯示爲狀態欄通知。

要清楚,我想:

enter image description here

,但我只看到狀態欄上顯示的應用程序圖標。

如何告訴FCM將我的通知顯示爲與我通過以下代碼獲得的內容相似的平視通知?

NotificationCompat.Builder mBuilder = 
       new NotificationCompat.Builder(context) 
         .setSmallIcon(R.drawable.ic_media_play) 
         .setContentTitle("My notification") 
         .setContentText("Hello World!") 
         .setDefaults(Notification.DEFAULT_ALL) 
         .setPriority(Notification.PRIORITY_HIGH); 
+0

你找到了這個解決方案安裝的react-native-push-notification

npm install zo0r/react-native-push-notification.git 

以下版本修復它。我有同樣的問題 – Carlos

+0

我也有同樣的問題。當應用程序處於前臺時,我可以生成單挑通知,但不能在應用程序處於後臺或死亡狀態時生成提醒通知。我得到的是系統托盤通知 –

+0

@Carlos我還沒有找到解決方案:( – Androidian

回答

0

我已經在你的index.android.js

function init(){ 
    PushNotification.configure({ 
     onNotification:async (notification)=>{ 
       if(!notification.userInteraction && !notification.foreground){ 
        PushNotification.localNotification({ 
         message: "you message" 
        }); 
        } 
       , 
       requestPermissions:true, 
       senderID:"31************", 
       popInitialNotification:false 
     }) 
} 
+0

我在談論一個Android本機應用程序;) – Androidian

相關問題