我正在使用django-push-notifications通过FCM从我的服务器(Django)发送一个通知:
from push_notifications.models import GCMDevice
agents_user_ids = [agent.user.id for agent in task.agents.all()]
devices = GCMDevice.objects.filter(user_id__in=agents_user_ids)
devices.send_message("You have a new task", title="New Task")我能够使用cordova-plugin-fcm在移动应用程序(离子1.3.3,angularj1.5.3)中接收数据
FCMPlugin.onNotification((data) => {
alert(JSON.stringify(data));
}, function(msg){
console.log("FCM Notification callback registered.");
}, function(err){
console.log("FCM Notification callback registration error: " + err);
});问题是没有通知显示在酒吧,没有振动,没有声音,.我已经使用额外的参数修改了devices.send_message选项,但是什么也没有发生。
在FCM文档之后,我通过添加以下内容修改了清单:
<application>
...
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_ic_notification" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
</application>这是应用程序配置的问题吗?用我从服务器发送通知的方式?或者只是我正在使用的插件,不要在通知栏中显示任何东西?
..。我是否应该使用接收到的数据手动创建通知?
发布于 2017-04-06 19:17:35
可能有两个原因
https://stackoverflow.com/questions/43260761
复制相似问题