Android 在Tianium中实现Ti.goosh推送通知模块以支持Firebase
我已经在我的应用程序中实现了Ti.goosh模块,用于从Firebase发送推送通知。我随后在Google开发者控制台API中创建了一个新项目。我从那里得到了一个项目编号,并在tiapp.xml中将其用作“GCM发送者ID”。然后,我在index.js控制器中添加了以下代码Android 在Tianium中实现Ti.goosh推送通知模块以支持Firebase,android,firebase,module,push-notification,titanium,Android,Firebase,Module,Push Notification,Titanium,我已经在我的应用程序中实现了Ti.goosh模块,用于从Firebase发送推送通知。我随后在Google开发者控制台API中创建了一个新项目。我从那里得到了一个项目编号,并在tiapp.xml中将其用作“GCM发送者ID”。然后,我在index.js控制器中添加了以下代码 var TiGoosh = require('ti.goosh'); TiGoosh.registerForPushNotifications({ // The callback to invoke when a
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密钥应该包含在这个模块的什么位置,以便与我的应用程序链接
我怎么能理解整件事?钛合金中的推送通知似乎非常复杂,文档也非常糟糕。使用ti.goosh发送通知并确认收到数据
您需要在脚本中包含您的api密钥和设备令牌(注册ID)查看已实施但在我这边不起作用的firebase模块。无法从firebase在我的应用程序中获取任何通知