Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked April 28th 2010 by Peter Lum
  • apn
  • apple
  • notification
  • push
0 Comments

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?

    — answered April 28th 2010 by Peter Lum
    permalink
    1 Comment
    • How can i do that ? please help me , i'm stuck on that message too .

      — commented October 23rd 2010 by Raquibul Islam
  • how to do HTTP PUT with username & password (what kind of format, eg: simple http request form or in json format) ?

    — answered June 23rd 2011 by Daniel Hasudungan
    permalink
    0 Comments
  • Hi Peter.
    Do you have this working? How? Do you use the Devicetoken with urban airship to send a push message?
    Thanks!

    — answered May 11th 2010 by Martijn Pannevis
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.