【发布时间】:2016-05-16 13:17:11
【问题描述】:
我正在 Android 上集成推送通知。
根据应用加速器article。
// notification setting
var deviceToken = null;
// Require the module
var CloudPush = require('ti.cloudpush');
// Initialize the module
CloudPush.retrieveDeviceToken({
success: deviceTokenSuccess,
error: deviceTokenError
});
// Enable push notifications for this device
// Save the device token for subsequent API calls
function deviceTokenSuccess(e) {
Ti.API.info("deviceTokenSuccess :" + e.deviceToken);
deviceToken = e.deviceToken;
}
function deviceTokenError(e) {
alert('Failed to register for push notifications! ' + e.error);
}
// Process incoming push notifications
CloudPush.addEventListener('callback', function (evt) {
alert("Notification received: " + evt.payload);
});
我需要获取 deviceToken 才能将通知推送到 android,但此脚本使用 CloudPush,它需要“titanium Arrow 服务”登录。
但是我想使用亚马逊 SNS 服务而不是“箭头服务”来推送消息,并且不想使用箭头服务。
(我已经完成了亚马逊SNS设置,iOS推送成功。)
如何在不使用 cloudpush 的情况下获取 android deviceToken。
有可能吗?
【问题讨论】:
-
在这种情况下,您将需要另一个模块来帮助您。 Cloudpush 只是一个例子。
-
您知道,您可以在没有 ACS 的情况下使用 Cloudpush,只需让另一个平台为您发送推送。 Cloudpush 只是接收端
-
谢谢@RentPot,如果我使用cloudpush获取deviceToken,我在哪里可以设置senderID和Apikey? (可能在 tiapp.xml...?或方法?)我用谷歌搜索,但除了使用 ACS 登录外找不到答案。
标签: android push-notification google-cloud-messaging titanium appcelerator