Titanium Community Questions & Answer Archive

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

Is it possible to obtain IMEI and IMSI from the mobile device?

Hi, I've been checking the APIs and I can't find anywhere how to retrieve the IMEI and IMSI codes from the device.

Is that possible at all?

Cheers.

— asked November 11th 2010 by GunsNRails GR
  • imei
  • imsi
  • mobile
0 Comments

4 Answers

  • Accepted Answer

    I've created a module based Jose Granados help.
    It uses Ericas IOKit extensions.
    You can retrieve the IMEI, SerialNumber and Backlight values.

    Download from here: http://dl.dropbox.com/u/13696999/au.com.isobaraustralia.titaniummodules.iokitextension.zip

    copy the extracted folder here: (create the iphone folder if not there already)
    /Library/Application Support/Titanium/modules/iphone

    edit your tiapp.xml and add this in between the modules tag at the bottom:

    <module version="0.1">au.com.isobaraustralia.titaniummodules.iokitextension</module>
    

    Then in your application, import the module and get the values.
    Here's a sample:

    var iokitextension = require('au.com.isobaraustralia.titaniummodules.iokitextension');
    
    // open a single window
    var window = Ti.UI.createWindow({
        backgroundColor:'white'
    });
    var label1 = Ti.UI.createLabel();
    window.add(label1);
    
    var label2 = Ti.UI.createLabel();
    window.add(label2);
    
    var label3 = Ti.UI.createLabel();
    window.add(label3);
    
    window.open();
    
    label1.text = iokitextension.imei();
    label2.text = iokitextension.serialnumber();
    label3.text = iokitextension.backlightlevel();
    
    Ti.API.info("*** IMEI =====> " + iokitextension.imei());
    Ti.API.info("*** Serial Number =====> " + iokitextension.serialnumber());
    Ti.API.info("*** Backlight Level =====> " + iokitextension.backlightlevel());
    

    Note: In the simulator, the values will be null. And the backlight value returns: VUV
    When you run that sample code on the device, you should get the real values

    Also note, that your application will most likely get rejected if publishing to the public app store.
    Just for internal use only.

    — answered January 19th 2011 by Daniel Tome
    permalink
    0 Comments
  • Hmm. No one? I thought this would be trivial question.

    Cheers.

    — answered November 11th 2010 by GunsNRails GR
    permalink
    0 Comments
  • I too would like this functionality.

    There doesn't seem to be anything in the documentation. I'd imagine someone would have to write a module to do that. Saying that, I wouldn't think it was a hugely difficult task for someone that knows objective c.

    Might be worth finding a module developer and asking them - or us asking the Titanium team directly.

    — answered November 20th 2010 by Steve Liddell
    permalink
    0 Comments
  • Hi, thanks for the reply. Yeah I think the way to go is to have custom module that takes care of that. I've found the way to get it for Android: http://www.anddev.org/tinytut_-_getting_theimsi-_imei_sim-device_unique_ids-t446.html

    For iPhone here's something but just for imei: https://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m

    So I guess making a plugin to get that from the system should be quite trivial. For those that have done a plugin before of course. There's some docs from Ti about those but i haven't checked them out much, the process looks a bit tricky but doable.

    Cheers.

    — answered November 21st 2010 by GunsNRails GR
    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.