whitebear
whitebear

Reputation: 12445

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

Upvotes: 1

Views: 494

Answers (1)

miga
miga

Reputation: 4055

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

Upvotes: 1

Related Questions