I want to receive incoming call pro-grammatically from my apps.
I tried some code but it's not working.
Below is my code for end call.
TelephonyManager tm = (TelephonyManager) ctx
.getSystemService(Context.TELEPHONY_SERVICE);
try {
if (tm == null) {
// this will be easier for debugging later on
throw new NullPointerException("tm == null");
}
tm.getClass().getMethod("endCall").invoke(tm);//answerRingingCall
} catch (Exception e) {
Log.e("sdsd", "Unable to use the Telephony Manager directly.", e);
}
}
Using this code I can able to end any of the incoming call, But when I change "endCall" to "answerRingingCall". it's not receive call from my app can you please help how to resolve this issue.
Regarding Permission I am not able to apply this permission on apps.
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
See attach screen shot.
it's showing Permission is only granted to System apps. How to resolve this.
Thanks in advance