Tkko / flutter_smart_auth

Flutter package for listening SMS code on Android, suggesting phone number, email, saving a credential.
https://pub.dev/packages/smart_auth
MIT License
43 stars 26 forks source link

Fix android sdk 34 RECEIVER_EXPORTED #16

Closed mahdinba97 closed 10 months ago

mahdinba97 commented 1 year ago

Description

Type of Change

Tkko commented 12 months ago

Hey @mahdinba97, can you provide the official docs where you found this info?

I checked the current main branch on both Android emulator and on the real device and the SMS Retriever API is working fine

mahdinba97 commented 12 months ago

Hi @Tkko here is the link to the new Behavior change in android 14 for intents. Restrictions to implicit and pending intents

It works on my emulator with Android 13. But the other one with Android 14, when I get to the page with the pinput in it, here is what I get:

I/flutter ( 6097): Pinput/SmartAuth: getSmsCode failed: PlatformException(error, com.example.package: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts, null, java.lang.SecurityException: com.example.package: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
I/flutter ( 6097):  at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
I/flutter ( 6097):  at android.os.Parcel.createException(Parcel.java:3041)
I/flutter ( 6097):  at android.os.Parcel.readException(Parcel.java:3024)
I/flutter ( 6097):  at android.os.Parcel.readException(Parcel.java:2966)
I/flutter ( 6097):  at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
I/flutter ( 6097):  at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
I/flutter ( 6097):  at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
I/flutter ( 6097):  at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:767)
I/flutter ( 6097):  at fman.ge.smart_auth.SmartAuthPlugin.startSmsRetriever(SmartAuthPlugin.kt:241)
I/flutter ( 6097):  at fman.ge.smart_auth.SmartAuthPlugin.onMethodCall(SmartAuthPlugin.kt:72)
I/flutter ( 6097):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
I/flutter ( 6097):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
I/flutter ( 6097):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
I/flutter ( 6097):  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
I/flutter ( 6097):  at android.os.Handler.handleCallback(Handler.java:958)
I/flutter ( 6097):  at android.os.Handler.dispatchMessage(Handler.java:99)
I/flutter ( 6097):  at android.os.Looper.loopOnce(Looper.java:205)
I/flutter ( 6097):  at android.os.Looper.loop(Looper.java:294)
I/flutter ( 6097):  at android.app.ActivityThread.main(ActivityThread.java:8177)
I/flutter ( 6097):  at java.lang.reflect.Method.invoke(Native Method)
I/flutter ( 6097):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
I/flutter ( 6097):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
I/flutter ( 6097): Caused by: android.os.RemoteException: Remote stack trace:
I/flutter ( 6097):  at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13927)
I/flutter ( 6097):  at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
I/flutter ( 6097):  at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720)
I/flutter ( 6097):  at android.os.Binder.execTransactInternal(Binder.java:1339)
I/flutter ( 6097):  at android.os.Binder.execTransact(Binder.java:1275)
I/flutter ( 6097): 
I/flutter ( 6097): )

Then I get the test SMS, but it does not get filled in the input.

Tkko commented 10 months ago

Thanks for the PR, I'll upload new version shortly.