Reputation: 809
I have my Android app and I want to to finish call phone from my application. How I can to do it?
Upvotes: 0
Views: 455
Reputation: 24031
you need to add this file ITelephony.aidl then use this method to end the call:
public static void callReject(Context context) throws Exception{
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());
}
}
Upvotes: 1