首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >已收到通知,但通知栏中没有显示图标

已收到通知,但通知栏中没有显示图标
EN

Stack Overflow用户
提问于 2017-04-06 16:25:20
回答 1查看 2.2K关注 0票数 0

我正在使用django-push-notifications通过FCM从我的服务器(Django)发送一个通知:

代码语言:javascript
复制
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)中接收数据

代码语言:javascript
复制
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文档之后,我通过添加以下内容修改了清单:

代码语言:javascript
复制
<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>

这是应用程序配置的问题吗?用我从服务器发送通知的方式?或者只是我正在使用的插件,不要在通知栏中显示任何东西?

..。我是否应该使用接收到的数据手动创建通知?

EN

回答 1

Stack Overflow用户

发布于 2017-04-06 19:17:35

可能有两个原因

  1. 收到应用程序时,你的应用程序在后台吗?检查https://firebase.google.com/docs/cloud-messaging/android/receive
  2. 此外,基于上述链接,只有在两种情况下,您的设备将自动显示您的消息作为通知。这条消息可能会传递到你的应用程序,在那里你的应用程序将需要推送一个通知到设备。检查https://developer.android.com/training/notify-user/build-notification.html
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43260761

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档