【问题标题】:django push notification to android using django-push-notifications librarydjango 使用 django-push-notifications 库向 android 推送通知
【发布时间】:2014-07-17 20:20:31
【问题描述】:

我有一个带有在 django 中开发的后端 Web 应用程序的 android 应用程序。

我正在使用django-push-notification 库在我的 django 后端应用程序中启用推送通知。

在 android 应用程序中,我将注册 id 发送到后端 django 应用程序,并成功存储在数据库中。

当我尝试从管理区域发送测试消息时,我确认所有消息都已发送,但我的 android 应用程序上没有收到任何消息。

我怀疑是 android 应用程序,但我写了一些代码来测试应用程序接收器,它工作正常,所以我认为问题出在 django 应用程序上。

有什么方法可以确保谷歌云消息服务接收到从 django 应用程序发送的消息?

【问题讨论】:

    标签: android python django push-notification google-cloud-messaging


    【解决方案1】:

    我很久以前就使用过 GCM 和 django-push-notification。虽然我记不太清了,但你可以试试这样的:

    • 在 django 发送消息后检查 GCM 的响应。
    • 确保您的 android 应用使用正确的密钥来获取消息正文(我记得 django-push-notification 使用 msg 密钥)

    【讨论】:

    • 谢谢 Toan。对于第二点,我在 android 应用程序上没有收到任何东西。我在调试模式下运行应用程序并在接收器的第一个方法上设置断点,但没有任何反应。对于第一点,我如何检查 GCM 响应?对不起,我是 python/Djagno 的新手。
    • send_message() 方法返回 GCM 响应。所以你可以分配response = gcmdevice.send_message(...) 然后print response
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    相关资源
    最近更新 更多