我的广播接收器不再工作了,我更新了我的平板电脑( Galaxy 2上的Android 10 )。应用程序没有更新/更改。所以我不知道现在是错的。
“宣言”未变:
<!-- SMS Receiver -->
<receiver
android:name=".services.sms.SMSReceiver_BroadcastReceiver"
android:exported="true" >
<intent-filter android:priority="999" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>该许可仍然给予:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />但是广播接收机没有尽到它的职责:
public class SMSReceiver_BroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(SMS_RECEIVED)) {
Toast.makeText(context, "SMS received", Toast.LENGTH_LONG).show();
}
...哪里有错?安全更新负责吗?我必须执行额外的代码吗?
发布于 2022-11-28 00:13:35
老问题,但是第一次搜索结果之一,我想我会发个答案.
Android 11需要注意以下几点:
,
android.provider.Telephony.SMS_DELIVER需要添加一个新的意图过滤操作:
https://stackoverflow.com/questions/70111964
复制相似问题