2013-12-19 22 views
1

我想知道如何在android中以編程方式結束傳入/傳出調用。 我試過解決方案here,但我沒有運氣讓它工作。如何在android中以編程方式結束傳入/傳出調用?

我使用下面的代碼斷開使用廣播呼叫...

try{ 
     TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); 
     Class c = Class.forName(manager.getClass().getName()); 
     Method m = c.getDeclaredMethod("getITelephony"); 
     m.setAccessible(true); 
     ITelephony telephony = (ITelephony)m.invoke(manager); 
     telephony.endCall(); 
    } catch(Exception e){ 
     Log.d("",e.getMessage()); 
    } 

但我得到的錯誤:

NO such method name 'getITelephony' in ICS call is not disconnecting 
+0

您可能想對「不幸」部分更具體。什麼不工作? – slhck

+0

每當我試圖使它工作,我得到的錯誤:沒有這樣的方法'getITelephony' –

+0

關於這個具體的錯誤有很多問題。您至少應該包括您正在使用的實際代碼,完整的錯誤,堆棧跟蹤,您的Android操作系統和SDK版本,並顯示您已經嘗試解決問題的內容。 – slhck

回答

1

我認爲這種方式不提供Android 2.3的更多+, this文章正在討論這個問題

相關問題