gpt4 book ai didi

android - 阻止来电

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:10 25 4
gpt4 key购买 nike

我的 VoiP 客户端想要在我自己的通话进行时阻止所有来电。有可能以某种方式做到这一点吗?

最佳答案

是的,您可以阻止来电。使用此代码

 String phonestate = bundle.getString(TelephonyManager.EXTRA_STATE);

try
{
if (TelephonyManager.EXTRA_STATE_RINGING.equalsIgnoreCase(phonestate))
{
try
{
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (com.android.internal.telephony.ITelephony) m.invoke(tm);
}
catch (Exception e)
{
e.printStackTrace();
}

if (prefStatus != null)
{
if (count == 1)
{
telephonyService.endCall();
String prefLoginemail = myloginpref.getString("emailid", null);
System.out.println(printdata + " prefLoginemail :: "+ prefLoginemail);

Global.mNotificationManager = (NotificationManager) mxcontext.getSystemService(Context.NOTIFICATION_SERVICE);
notifyDetails = new Notification(com.CellPhoneTerror.R.drawable.icon1,"CellPhoneTerror!", System.currentTimeMillis());
myIntent = PendingIntent.getActivity(mxcontext, 0, new Intent(mxcontext, clsHomePage.class), 0);

notifyDetails.setLatestEventInfo(mxcontext,"You Got a Call from Blocked Number.", "",myIntent);
notifyDetails.flags |= Notification.FLAG_AUTO_CANCEL;
Global.mNotificationManager.notify(Global.SIMPLE_NOTFICATION_ID,notifyDetails);

}
}
}
if (prefIncomingBlock.equals("true"))
{
if (TelephonyManager.EXTRA_STATE_IDLE.equalsIgnoreCase(phonestate))
{
if (count == 0)
{
System.out.println("if Cellphoneterror:"+ Global.clsIncomingNum);
Intent block = new Intent(context, dialogbox1.class);
block.setFlags(intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(block);
}
}
}
}
catch (Exception e)
{
e.printStackTrace();
}

谢谢。

关于android - 阻止来电,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2334465/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com