xsiraul
xsiraul

Reputation: 414

Adobe Flex get user phone number

I want to know is it possible to get a user phone number of device where app is running or not? I am using 4.6 version.

If yes, please notice me how / which extensions/libraries i should use.

Thank you for your time xsiraul

Upvotes: 1

Views: 1207

Answers (1)

Dominic Tancredi
Dominic Tancredi

Reputation: 42342

EDIT:

In re-reviewing this question, it seems you are specifically asking about AIR and access to a telephone number via Android. I'm making that assumption based on the "android" tag but please edit your question to be specific since building an App on AIR for mobile devices could target multiple platforms.

For AIR development on an Android platform, I don't believe there is access directly to the "TelephonyManager" via the Actionscript API.

Normally, in Java building to Android, you would do something similar to this:

TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String myNumber = mTelephonyMgr.getLine1Number();

However, since you're on AIR, you'll need to either find or build a "Custom Extension" to add to the AIR SDK. Here is a tutorial on how to do so (from this SO answer): http://www.jamesward.com/2011/05/11/extending-air-for-android/

Someone has tried to create a custom AIR extension for accessing the TelephonyManager but it seems they weren't successful in finishing the Extension. It should be very straightforward to build a simple extension to access the manager and the information you want (assuming this is for an Android device). However, you'll need to program defensively, because not all phone numbers are stored on the device SIM card.

I hope this helps, and my apologies at assuming this was for an iOS environment.

Upvotes: 1

Related Questions