【问题标题】:Implementing Ti.goosh push notification module in Titanium for Firebase support在 Titanium 中实现 Ti.goosh 推送通知模块以支持 Firebase
【发布时间】:2018-11-10 02:15:21
【问题描述】:

我在我的应用中实现了 Ti.goosh 模块,用于从 Firebase 发送推送通知。我关注了this git document,并在 Google Developer Console API 中创建了一个新项目。我从那里获得了一个项目编号,并将其用作 tiapp.xml 中的“GCM 发件人 ID”。然后我在 index.js 控制器中添加了以下代码。

var TiGoosh = require('ti.goosh');
TiGoosh.registerForPushNotifications({


    // The callback to invoke when a notification arrives.
    callback: function(e) {
    
        var data = JSON.parse(e.data || '');
    
    },

    // The callback invoked when you have the device token.
    success: function(e) {

        // Send the e.deviceToken variable to your PUSH server
        Ti.API.log('Notifications: device token is ' + e.deviceToken);

    },

    // The callback invoked on some errors.
    error: function(err) {
        Ti.API.error('Notifications: Retrieve device token failed', err);
    }
});

当我运行应用程序时,成功块执行并且我得到了设备令牌。但我没有收到来自 firebase 的消息。我也无法理解 Firebase 中的服务器密钥和 API 密钥应该包含在此模块中的哪个位置以与我的应用程序链接。

我怎样才能理解整个事情? Titanium 中的推送通知似乎非常复杂,文档也很差。

【问题讨论】:

标签: android firebase module push-notification titanium


【解决方案1】:

使用this php script 发送通知并通过 ti.goosh 确认您收到数据

您需要在脚本中包含您的 api 密钥和设备令牌 (registration_ids)

【讨论】:

    猜你喜欢
    • 2016-05-18
    • 2012-08-09
    • 2023-03-17
    • 1970-01-01
    • 2017-11-29
    • 1970-01-01
    • 2019-11-10
    • 2015-01-30
    • 2018-05-06
    相关资源
    最近更新 更多