Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,160 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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();
}