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

相关问题