private int getCallState() { int nState = 0; Class<TelephonyManager> c = TelephonyManager.class; Method getITelephonyMethod = null; try { getITelephonyMethod = c.getDeclaredMethod("getITelephony", (Class[]) null); getITelephonyMethod.setAccessible(true); TelephonyManager tManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); Object iTelephony = (Object) getITelephonyMethod.invoke(tManager,(Object[]) null); Method getCallState = iTelephony.getClass().getDeclaredMethod("getCallState"); nState = ((Integer) getCallState.invoke(iTelephony)).intValue(); } catch (Exception e) { e.printStackTrace(); } return nState; }