• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get Device id in Air for Android

Guest
Jan 02, 2014 Jan 02, 2014

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

TOPICS
ActionScript

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

check for an ane that does that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2014 Jan 02, 2014

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2014 Jan 02, 2014

Copy link to clipboard

Copied

LATEST

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).

Example ANE

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines