【问题标题】:unable to end call in android verstion 2.2.6在 android 版本 2.2.6 中无法结束通话
【发布时间】:2012-05-19 22:11:41
【问题描述】:

我尝试使用以下方法结束通话

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);
    }
}

这适用于 android 2.2 版,但无法在 android 2.2.6 版中结束通话 我不知道这段代码有什么问题。

我得到了解决方案,我只是注释掉了这行 telephonyService.silenceRinger(); 因为android 2.3以上版本不支持此方法

请帮帮我 谢谢你。

【问题讨论】:

    标签: android telephonymanager getmethod


    【解决方案1】:

    Android 在 2.2 之后发生了变化,这些技巧不再有效

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-01
      • 2017-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多