如何在特定时间阻止 Android 设备拨出某个号码的电话?我已经使用以下权限:android.permission.PROCESS_OUTGOING_CALLS,但接收者无法停止通话。
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<receiver android:name=".receiver.NewOutgoingCallReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
这是接收器的代码:
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
String incomingNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
Log.d("NewOutgoingCallReceiver",
">>>>>> Intent.EXTRA_PHONE_NUMBER: "
+ incomingNumber);
Toast.makeText(context, "Call - " + incomingNumber, Toast.LENGTH_LONG).show();
abortBroadcast();
}
安卓系统仍在拨打电话。在此演示中,我只想让系统停止拨打所有电话。
android.permission.PROCESS_OUTGOING_CALLS
真的需要吗? - Elad Benda