Apple Push Notification guidelines for Titanium SDK and Urban Airship
Hi
I am totally new to APN. I read up on UA (Urban Airship) website and Ti website but still getting not much …
Has someone implemented APN using Ti and UA before?
If so, a small snippet of code would be very much appreciated!
Right now, I am using the following code for registration:
////////////////// - APN - ///////////////////////
// register for push notifications
Titanium.Network.registerForPushNotifications({
types: [
Titanium.Network.NOTIFICATION_TYPE_BADGE,
Titanium.Network.NOTIFICATION_TYPE_ALERT,
Titanium.Network.NOTIFICATION_TYPE_SOUND
],
success:function(e)
{
alert('LOL :'+ e.deviceToken);
var deviceToken = e.deviceToken;
APNState = 2;
alert("Push notification device token is:"+deviceToken+"Push notification types:" + Titanium.Network.remoteNotificationTypes + "Push notification enabled: " + Titanium.Network.remoteNotificationsEnabled);
},
error:function(e)
{
alert('Error :'+ e.error);
APNState = 3;
},
callback:function(e)
{
// called when a push notification is received.
alert("Received a push notificationnnPayload:nn"+JSON.stringify(e.data));
APNState = 4;
}
});
But when I use it on the device, I have the following error:
Error: Domain=NSCocoaErrorDomain Code=3000 Userinfo=0x3978b0 ''no valid aps-environment entitlement string found for application'
What is happening here?
3 Answers
-
I got it. I have to use an entire new provisioning profile.
Anyone knows how to do a http put with username and password?
-
how to do HTTP PUT with username & password (what kind of format, eg: simple http request form or in json format) ?
-
Hi Peter.
Do you have this working? How? Do you use the Devicetoken with urban airship to send a push message?
Thanks!