5,381 questions
This is how to HangUp PhoneCall in Android 9.0 BUT how to do it in Android 10.0
GolfMan
21
Reputation points
void IncomingCallHang()
{
var manager = (TelephonyManager)Application.Context.GetSystemService(Context.TelephonyService);
IntPtr TelephonyManager_getITelephony = JNIEnv.GetMethodID(
manager.Class.Handle,
"getITelephony",
"()Lcom/android/internal/telephony/ITelephony;");
IntPtr telephony = JNIEnv.CallObjectMethod(manager.Handle, TelephonyManager_getITelephony);
IntPtr ITelephony_class = JNIEnv.GetObjectClass(telephony);
IntPtr ITelephony_endCall = JNIEnv.GetMethodID(
ITelephony_class,
"endCall",
"()Z");
JNIEnv.CallBooleanMethod(telephony, ITelephony_endCall);
JNIEnv.DeleteLocalRef(telephony);
JNIEnv.DeleteLocalRef(ITelephony_class);
//Toast.MakeText(context, telephoneNumber + "Is Blocked", ToastLength.Long).Show();
}
Developer technologies | .NET | Xamarin
Sign in to answer