1

I recently download an Android app that allowed a program to send a text via my number. I did not share my number. It just sent it because it had "send SMS messages" enabled.

I don't know if they coded in air for android using as3 but i know it is possible to get the android device phone.

Any ideas on how to do that? I know how to send a sms once I get the users phone. I can do this by sending the users phone to a php script. But I don't know how to get their phone number.

Thanks

UPDATE 9/24/12

I found this bit of code thanks to a post below. However, I do not know how to call the TELEPHONY_SERVICE class.

I think I need this line of code below but I don't know how to use it. Context.getSystemService(Context.TELEPHONY_SERVICE)

Here is a link to where I got the info: http://developer.android.com/reference/android/telephony/TelephonyManager.html

UPDATE 10/01/12

With the help of someone I found even more code. I think this could work but I can't get adobe cs6 flash professional to see the extension. Here is a screen shot of my errors: https://odesk-prod-att.s3.amazonaws.com/MC:201245014:1?AWSAccessKeyId=1XVAX3FNQZAFC9GJCFR2&Expires=2147483647&Signature=SV3aFpOc5UWPHo9egNl%2BVPGVeSo%3D

Also here is a link to an extension that looks promising to work: http://candymandesign.blogspot.co.uk/2012/02/adobe-air-native-extension-read-phone.html

Here is a video tutorial that I found using ANE. But with all of these it still does not work. http://www.youtube.com/watch?v=Axg6E001a7I

CAN ANYONE GET THESE TO WORK? THANKS

Papa De Beau
  • 3,744
  • 18
  • 79
  • 137

2 Answers2

1

You will need to write an AIR native extension to do that.

TobiHeidi
  • 1,201
  • 2
  • 14
  • 23
1

To add to the existing answer I believe the part you would need to write on the Java side would need this to pull the phone number:

TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();

This information pulled from another SO post strictly looking at pulling the number, see details in the comments there regarding caveats to using this method and some issues encountered by others Programmatically obtain the phone number of the Android phone

Community
  • 1
  • 1
shaunhusain
  • 19,630
  • 4
  • 38
  • 51
  • I added an update above. I don't know how to call the TelephonyManager. It is not working on Flash Professional. Do I have to import something else first? – Papa De Beau Sep 24 '12 at 23:07
  • No this isn't AS3 code this would be what you would put in the Java Android part of an adobe native extension. Basically my limited understanding of how this works is you compile a bit of Java for Android or Objective C for iOS support, then include a bit of metadata that tells your AIR app how to invoke your native part, this is just a piece of the puzzle, basically you could take another example that includes that Java side from the link below http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/gyroscope.html notice the different parts to building the ANE. – shaunhusain Sep 26 '12 at 00:33