telephonymanager
Disable Proximity Sensor during call
After trying a whole bunch of fixes including: Phone app’s menu option (my phone did not have a option to disable) Proximity Screen Off Lite (did not work) Xposed Framework with sensor disabler (works till phone is rebooted or app updates) Macrodroid macro (Macrodroid does not run on my phone for some reason) put some … Read more
Retrieve incoming call’s phone number in Android
Use PhoneStateListener. It has an onCallStateChanged handler; one of the supplied arguments you’ll get is a String containing the incoming phone number.
How to get current SIM card number in Android?
I think sim serial Number and sim number is unique. You can try this for get sim serial number and get sim number and Don’t forget to add permission in manifest file. TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String getSimSerialNumber = telemamanger.getSimSerialNumber(); String getSimNumber = telemamanger.getLine1Number(); And add below permission into your Androidmanifest.xml file. <uses-permission android:name=”android.permission.READ_PHONE_STATE”/> … Read more
How to hang up outgoing call in Android?
Capturing the outgoing call in a BroadcastReceiver has been mentioned and is definitely the best way to do it if you want to end the call before dialing. Once dialing or in-call, however, that technique no longer works. The only way to hang up that I’ve encountered so far, is to do so through Java … Read more
Getting telephone US local area code with Android
1- Add This Array to Strings.xml File <string-array name=”CountryCodes” > <item>93,AF</item> <item>355,AL</item> <item>213,DZ</item> <item>376,AD</item> <item>244,AO</item> <item>672,AQ</item> <item>54,AR</item> <item>374,AM</item> <item>297,AW</item> <item>61,AU</item> <item>43,AT</item> <item>994,AZ</item> <item>973,BH</item> <item>880,BD</item> <item>375,BY</item> <item>32,BE</item> <item>501,BZ</item> <item>229,BJ</item> <item>975,BT</item> <item>591,BO</item> <item>387,BA</item> <item>267,BW</item> <item>55,BR</item> <item>673,BN</item> <item>359,BG</item> <item>226,BF</item> <item>95,MM</item> <item>257,BI</item> <item>855,KH</item> <item>237,CM</item> <item>1,CA</item> <item>238,CV</item> <item>236,CF</item> <item>235,TD</item> <item>56,CL</item> <item>86,CN</item> <item>61,CX</item> <item>61,CC</item> <item>57,CO</item> <item>269,KM</item> <item>242,CG</item> <item>243,CD</item> <item>682,CK</item> <item>506,CR</item> <item>385,HR</item> … Read more
How can I check whether the Sim Card is available in an android device?
Use TelephonyManager. http://developer.android.com/reference/android/telephony/TelephonyManager.html As Falmarri notes, you will want to use getPhoneType FIRST of all, to see if you are even dealing with a GSM phone. If you are, then you can also get the SIM state. TelephonyManager telMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); int simState = telMgr.getSimState(); switch (simState) { case TelephonyManager.SIM_STATE_ABSENT: // do something break; … Read more
Programmatically obtain the phone number of the Android phone
Code: TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE); String mPhoneNumber = tMgr.getLine1Number(); Required Permission: <uses-permission android:name=”android.permission.READ_PHONE_STATE”/> Caveats: According to the highly upvoted comments, there are a few caveats to be aware of. This can return null or “” or even “???????”, and it can return a stale phone number that is no longer valid. If you want something … Read more