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.
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/iphoneedit 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 valuesAlso note, that your application will most likely get rejected if publishing to the public app store.
Just for internal use only. -
Hmm. No one? I thought this would be trivial question.
Cheers.
-
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.
-
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.