Titanium Community Questions & Answer Archive

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

Detection of Apple devices (iphone 3GS, iphone 4, ipad, ipod, etc)

Is there a way to detect what apple device the app is currently running on at runtime?

I need to detect at least ipod, iphone 3 and 4 and ipad.

Thanks!

— asked August 28th 2010 by Peter Lum
  • 3gs
  • 4
  • apple
  • detection
  • devices
  • ipad
  • iphone
  • ipod
0 Comments

3 Answers

  • Accepted Answer

    http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform-module

    architecture and model should help you.

    — answered August 28th 2010 by Dan Tamas
    permalink
    1 Comment
    • Also, I believe "osname" returns differently for iPhones/iPod Touches and iPads, so you might be able to use that aswell as architecture and model, as Tamas said.

      — commented August 28th 2010 by Colton Arabsky
  • var ab = Ti.Platform.model.split(' ');

    if(ab[0] == 'iPhone') {
    
        alert(' fonud Iphone ')
    } else {
    
        alert('not Iphone');
    }
    

    you can find only iphone you can check ab[0]="iPhone " if this not work

    — answered May 15th 2012 by Jayesh Joshi
    permalink
    0 Comments
  • var ab = Ti.Platform.model;

    var ipn = ab.search('iPhone');

    if(ipn == 0) {
    
      alert(iphone found);
    

    }

    //you can detect any iphone using above code

    — answered June 11th 2012 by Jayesh Joshi
    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.