Why ITelephony.aidl works?

Actually, adding ITelephony.aidl to your project isn’t necessary, it is just a convenience. You could just as well do it this way: TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod(“getITelephony”); m.setAccessible(true); Object telephonyService = m.invoke(tm); // Get the internal ITelephony object c = Class.forName(telephonyService.getClass().getName()); // Get its class m … Read more

end incoming call programmatically

Try this Sure it will work. It’s working fine for me. You could download the ITelephony.java file from ITelephony.java After that you add the method to end call: Function to Disconnect call public void disconnectCall(){ try { String serviceManagerName = “android.os.ServiceManager”; String serviceManagerNativeName = “android.os.ServiceManagerNative”; String telephonyName = “com.android.internal.telephony.ITelephony”; Class<?> telephonyClass; Class<?> telephonyStubClass; Class<?> serviceManagerClass; … Read more

getAllCellInfo returns null in android 4.2.1

From TelephonyManager.getAllCellInfo() javadoc: This is preferred over using getCellLocation although for older devices this may return null in which case getCellLocation should be called. Some sources report that this method is only implemented on CDMA/LTE devices, and other types of devices (including GSM/LTE ones) will return null. Where implemented, it will return only LTE cells. … Read more

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 monitor SIM state change

The Intent android.intent.action.SIM_STATE_CHANGED is broadcast when the SIM state changes. For example, on my HTC Desire with a T-Mobile SIM card, if I put the device into flight mode the following Intent is broadcast: Intent: android.intent.action.SIM_STATE_CHANGED with extras: ss = NOT_READY, reason = null If I then take it out of flight mode, the following … 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

How to know whether I am in a call on Android?

You need broadcast receiver … In manifest declare broadcast receiver … <receiver android:name=”.PhoneStateBroadcastReceiver”> <intent-filter> <action android:name=”android.intent.action.PHONE_STATE”/> </intent-filter> </receiver> Also declare uses-permission … <uses-permission android:name=”android.permission.READ_PHONE_STATE” /> The broadcast receiver class … package x.y; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; public class PhoneStateBroadcastReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { … 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