DISQUS

DISQUS Hello! britg is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Extending PhoneGap to Return the iPhone’s Unique Identifier

Started by britg · 10 months ago

No excerpt available. Jump to website »

12 comments

  • awesome... and thanks for figuring out the keyboard issue!
  • hey no problem!
  • I get an "undefined" after adding all this to my project ... any idea's ?
  • Hmm, when and where are you getting undefined? i.e. what's the context? Are you doing something like alert(Device.uniqueIdentifier) ?

    If you can pastie your javascript code, maybe I can weed out the issue.
  • Here's the JS part


    *************
    var Device = {

    available: false,
    model: "",
    version: "",
    isIPhone: null,
    isIPod: null,

    init: function(model, version) {
    try {
    Device.available = __gap;
    Device.model = __gap_device_model;
    Device.version = __gap_device_version;
    Device.gapVersion = __gap_version;
    Device.uniqueIdentifier = __gap_device_uniqueid;
    } catch(e) {
    alert("GAP is not supported!")
    }
    },

    *************

    and in my page i have :

    *************
    window.onload = function()
    {
    Device.init();
    $('infomodel').innerHTML = Device.model;
    $('infoversion').innerHTML = Device.version;
    $('infouniqueid').innerHTML = Device.uniqueIdentifier;

    Device.Location.callback = updateLocationCallback;
    Device.Image.callback = 'image.lasso?data=';
    }
    ....

    *************
  • Hmm, that all looks solid. Here's a silly question - you've compiled and re-run the phonegap app in xcode, correct? also, are you using your physical iphone or the simulator?
  • Could this be linked to the fact i'm using a 1st generation iPhone ? Is that not supported on them ?
  • From everything I've read I assumed that the ID is available to all iphones
    and ipod touches. I can't find a case in my limited searching where the
    first gen iphones done return a unique Identifier, but I don't have one
    myself.
  • I tried implementing this again in the latest build ... but with no success. All other GAP functions do not react anymore ...

    Maybe you need to explain this to Sintaxi, so he can build it in in the next master.

    L.
  • Yes, I will definitely suggest adding this in to the trunk - not sure what
    problems you're running into as I didn't see those. If you can pastebin
    your code somewhere I will try to find some time to look at it in the next
    couple days.
  • any luck with getting access to the keyboard through uiwebview? I've been racking my brain trying to find a way. the only thing I could think of was to (for my specific example), create a stringByEvaluatingJavaScriptFromString message, where the javascript looks for a specific "id" on the page and then calls .focus() on it... I was hoping it would work, but no dice. it seems although it gains focus, that isn't enough to tell the iphone to pull up the keyboard :S
  • Hey Sahil - yes actually I did get the problem fixed. You can find my
    solution here:
    http://britg.com/2008/08/23/fixing-the-keyboard...

    Hope that helps!

Add New Comment

Returning? Login