Copy link to clipboard
Copied
Hi
Is ther e any way to get imei or device number of mobile with in As3 Air application.
Please suggest, Thanks
Copy link to clipboard
Copied
check for an ane that does that.
Copy link to clipboard
Copied
It's best practice to ask the user but there's a chance you can get it with an ANE, but AIR SDK does not support this. The reason why is very well outlined in what I linked. I've run this on my own phone and I retrieved the number but in other parts of the world (I'm in the USA) the number is not always in the network.
Copy link to clipboard
Copied
It's a simple string to pass through so here's a quick wrap I made targeting a minimum of Android OS 2.3.3 API 10. I only enabled a single method in it, getNumber(). This isn't the most robust means of doing it but it should work for you for the majority of population of cells. Note, not all networks send a number as mentioned above, but if it does this should retrieve the number and hand it back in a string (e.g. 18005551234).
No SWC needed.
Example usage (make sure you include it as an ANE, and add the extension in your app XML):
// import
import com.ertp.ane.android.AndroidDeviceDetails;
// get a context
var device:AndroidDeviceDetails = new AndroidDeviceDetails();
// attempt to read number
var phoneNumber:String = device.getNumber();
// check if null is returned (no network number)
if (phone != null)
{
trace("Phone number is: " + phoneNumber);
}
else
{
trace("Network reports no number :-(");
}
Note you will need this permission in your manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Please tell me when you download this as I need to remove this link.