简体   繁体   中英

getDeviceToken of android without cloudpush

I am integrating push notification on Android.

According to the appcelerator 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);
});

I need to get the deviceToken to push notification to android, but this script uses CloudPush, it requires 'titanium Arrow service' login.

However I want use amazon SNS service to push the message instead of 'Arrow service' and want not to use Arrow service.

(I already finished the amazon SNS setting and was successful in push notification in iOS.)

How can I get the android deviceToken without using cloudpush.

Is it possible??

您可以使用https://github.com/morinel/gcmpush来获取设备令牌

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM