我试图替换android来电屏幕。这是我尝试的方式;
广播接收者在更改语音时接收广播。该软件可以处理即将到来的呼叫并尝试中止广播,但这不起作用。有没有办法取消或修改默认的来电屏幕。
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cemtuver.fullycid"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:enabled="true">
<receiver android:name=".FullycidReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
</manifest>
FullycidReceiver:
public class FullycidReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle!=null) {
String state = bundle.getString(TelephonyManager.EXTRA_STATE);
Log.w("FULLYCID DEV LOG - STATE", state);
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
setResultData(null);
abortBroadcast();
}
}
}
}
我读过一篇文章,指出来电广播是非广播的,因此广播优先级并不重要,广播不能中止。