Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Crash on Android 14 #27

Open
MatrixDev opened this issue Jan 10, 2024 · 0 comments
Open

Crash on Android 14 #27

MatrixDev opened this issue Jan 10, 2024 · 0 comments

Comments

@MatrixDev
Copy link

MatrixDev commented Jan 10, 2024

Fatal Exception: java.lang.SecurityException
One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
- android.os.Parcel.createExceptionOrNull (Parcel.java:3069)
- android.content.ContextWrapper.registerReceiver (ContextWrapper.java:772)
- com.oval.sms_receiver.SmsReceiverPlugin$startListening$1.invoke (SmsReceiverPlugin.java:1)
- com.oval.sms_receiver.SmsReceiverPlugin$startListening$1.invoke (SmsReceiverPlugin.java:1)
- com.oval.sms_receiver.SmsReceiverPlugin.startListening$lambda$1 (SmsReceiverPlugin.java:1)
- com.google.android.gms.tasks.zzm.run (zzm.java:25)
- com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
image

Most probably you should add RECEIVER_EXPORTED when registering a BroadcastReceiver in SmsReceiverPlugin.kt#84:

// old
activity.registerReceiver(smsBroadcastReceiver,
        IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION))

// new
if (Build.VERSION.SDK_INT >= 33) {
  activity.registerReceiver(smsBroadcastReceiver,
    IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION),
    Context.RECEIVER_EXPORTED)
} else {
  activity.registerReceiver(smsBroadcastReceiver,
    IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION))
}
MatrixDev pushed a commit to MatrixDev/flutter_sms_receiver that referenced this issue Jan 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant