unable to end call in android verstion 2.2.6

[亡魂溺海] 提交于 2019-12-25 08:57:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!