android掛斷電話的功能

貌似只有這樣纔行,利用反射獲得隱藏的api。視頻裏面講的。


private void endCall(){

 
  try {
Class<?> clazz= getClassLoader().loadClass("android.os.ServiceManager");

Method method = clazz.getDeclaredMethod("getService", String.class);
  IBinder iBinder = (IBinder) method.invoke(null, TELEPHONY_SERVICE);


           ITelephony iTelephony = ITelephony.Stub.asInterface(iBinder);


           iTelephony.endCall();




  } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
 }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章