Titanium Community Questions & Answer Archive

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

Push Notifications, Urban Airship, Appcelerator Blog Post

I followed the instructions in the blog post. only problem is that e.deviceToken is TIBlob, not a string.

any thoughts? any way to index into TIBlob and get the string/text/value?

e.deviceToken is [object TiBlob]

e.deviceToken.text is null

e.deviceToken.value is undefined


Yeah, these push notifications with urban airship are dead in the water until we can get this TiBlob thing worked out.

It appears the the object "e" sent to successCallback(e) for Titanium.Network.registerForPushNotifications returns this:

{

deviceToken = "[object TiBlob]";

source = "[object NetworkModule]";

type = remote;

}

until deviceToken equals a string, there won't be any push notifications!!! how do we get the device token out of that TiBlog thing??

— asked October 30th 2010 by Jason Heidecker
2 Comments
  • e.deviceToken is [object TiBlob]
    e.deviceToken.text is null
    e.deviceToken.value is undefined

    — commented October 30th 2010 by Jason Heidecker
  • Yeah, these push notifications with urban airship are dead in the water until we can get this TiBlob thing worked out.

    It appears the the object "e" sent to successCallback(e) for Titanium.Network.registerForPushNotifications returns this:
    {
    deviceToken = "[object TiBlob]";
    source = "[object NetworkModule]";
    type = remote;
    }

    until deviceToken equals a string, there won't be any push notifications!!! how do we get the device token out of that TiBlog thing??

    — commented October 30th 2010 by Jason Heidecker

4 Answers

  • ANSWER

    Use

    var deviceToken=Ti.Network.remoteDeviceUUID

    instead of using

    e.deviceToken

    — answered October 30th 2010 by Jason Heidecker
    permalink
    2 Comments
    • This is what I use.

      — commented October 31st 2010 by Sj Singh
    • For me, on iphone emulator, remoteDeviceUUID is null?

      Ti.API.info("App is loading for device: " + Ti.Network.remoteDeviceUUID);

      Yeilds: App is loading for device: null

      — commented December 1st 2010 by Anthony Webb
  • What does e.deviceToken.type return?

    — answered October 30th 2010 by John McKnight
    permalink
    4 Comments
    • [object TiBlob]

      — commented October 30th 2010 by Jason Heidecker
    • John, sorry… I have not tried e.deviceToken.type. i'm guessing that's type TiBlob?

      — commented October 30th 2010 by Jason Heidecker
    • type should give me a hint to the type of data that TiBlob believes it is holding and it will also help explain IF .text will work. In the case of iOS, .text will only work if the type is TiBlobTypeFile or TiBlobTypeData. Anything else, valid or not, will return nil.

      — commented October 31st 2010 by John McKnight
    • BTW - iOS supports toString but it uses .text to fetch the data to return so I will assume that if .text doesn't work, neither will .toString({})

      — commented October 31st 2010 by John McKnight
  • Just an FYI: This issue (e.deviceToken being a TiBlob rather than a string) seems not to exist in the released 1.4.2.

    — answered November 17th 2010 by Jonathan Harlap
    permalink
    0 Comments
  • An alternative is to set an alias when registrations happen and set the alias to something that is a unique string like: Titanium.Platform.id

    Has anyone figured out how to set any tags or aliases with urban airship? From the docs it looks like you need to pass some JSON in the post?

    — answered December 1st 2010 by Anthony Webb
    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.