优化:兼容OV系手机短信广播

This commit is contained in:
pppscn 2022-02-21 13:07:41 +08:00
parent d438096264
commit a1fa816e89
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
@ -133,6 +134,9 @@
android:permission="android.permission.BROADCAST_SMS"
tools:ignore="IntentFilterExportedReceiver">
<intent-filter android:priority="2147483647">
<!--兼容OV系手机短信广播-->
<action android:name="android.provider.OppoSpeechAssist.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.SMS_DELIVER" />
<!--短信广播-->
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>

View File

@ -33,7 +33,11 @@ public class SmsBroadcastReceiver extends BroadcastReceiver {
String receiveAction = intent.getAction();
String TAG = "SmsBroadcastReceiver";
Log.d(TAG, "onReceive intent " + receiveAction);
if ("android.provider.Telephony.SMS_RECEIVED".equals(receiveAction)) {
String SMS_RECEIVED_ACTION = "android.provider.Telephony.SMS_RECEIVED";
String SMS_DELIVER_ACTION = "android.provider.Telephony.SMS_DELIVER";
if (SMS_RECEIVED_ACTION.equals(receiveAction) || SMS_DELIVER_ACTION.equals(receiveAction)) {
try {
if (!SettingUtil.getSwitchEnableSms()) {
return;