1
votes

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??

1
You will need another module to help you out in that case. Cloudpush is just an example. - Rene Pot
Just so you know, you can use Cloudpush without ACS, and just let another platform send your pushes for you. Cloudpush is only the receiving end - Rene Pot
THanks @RentPot , in the case I use cloudpush to get the deviceToken, where can I set the senderID and Apikey? (might be in tiapp.xml...?or method? ) I googled around but can't find the answer nothing than using ACS login. - whitebear

1 Answers

1
votes

You can use https://github.com/morinel/gcmpush to get the device token