问题
i trying to end call using below method to e
private void getTeleService(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
try {
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
telephonyService.silenceRinger();
telephonyService.endCall();
} catch (Exception e) {
e.printStackTrace();
Log.e("","FATAL ERROR: could not connect to telephony subsystem");
Log.e("", "Exception object: " + e);
}
}
this working fine with android version 2.2 but unable to end call in android version 2.2.6 i don't know what wrong in this code.
i got the solution i just comment out this line telephonyService.silenceRinger(); because this method is not support above android 2.3 version
please help me thanks in adv.
回答1:
Android was changed after 2.2, these tricks non longer work
来源:https://stackoverflow.com/questions/10549234/unable-to-end-call-in-android-verstion-2-2-6