我编写了一个Android SMS Receiver程序,如下所示。问题在于无法接收SMS广播。我该怎么办?
AndroidManifest.xml
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<receiver
android:name=".ExampleBroadcastReceiver2"
android:enabled="true"
android:exported="false"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter android:priority="999" >
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED" />
<action android:name="android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
<action android:name="android.telephony.action.CARRIER_CONFIG_CHANGED" />
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED" />
<action android:name="android.provider.Telephony.SMS_CB_RECEIVED" />
<action android:name="android.cellbroadcastreceiver.START_CONFIG" />
<action android:name="android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED" />
<action android:name="android.intent.action.LOCALE_CHANGED" />
<action android:name="android.provider.Telephony.SMS_DELIVER" />
</intent-filter>
</receiver>
</application>
详细的程序链接如下:
https://drive.google.com/file/d/1etiXj0DmPwmIx8S1aLeDPqz20XDaiOQy/view?usp=sharing