public
Last active

ACS Push Notification

  • Download Gist
acspushnotification.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Cloud.Users.login({
login : 'default',
password : 'default'
}, function(e) {
if (e.success) {
var user = e.users[0];
alert('Success:\\n' + 'id: ' + user.id + '\\n' + 'first name: ' + user.first_name + '\\n' + 'last name: ' + user.last_name);
 
// Now that you've logged in, register for PNS
var myPushDeviceToken
Ti.Network.registerForPushNotifications({
type : [Ti.Network.NOTIFICATION_TYPE_ALERT, Ti.Network.NOTIFICATION_TYPE_BADGE, Ti.Network.NOTIFICATION_TYPE_SOUND],
success : myPushDeviceToken
});
} else {
alert('Error:\\n' + ((e.error && e.message) || JSON.stringify(e)));
}
});

This is a fragment used to assist someone in the Atlanta Titanium User Group.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.