jaumard / sms_autofill

Flutter plugin to provide SMS code autofill support
MIT License
289 stars 183 forks source link

unregisterReceiver not working #45

Open felixfirefighter opened 4 years ago

felixfirefighter commented 4 years ago

Version: 1.2.1 Platform: Android

How to simulate Get the example project. https://github.com/jaumard/sms_autofill/blob/master/example/lib/main.dart

Note that it does call unregisterReceiver inside dispose.

The following error will be thrown when back button is clicked to close the app.

E/ActivityThread(11979): Activity com.example.sms.MainActivity has leaked IntentReceiver com.jaumard.smsautofill.SmsAutoFillPlugin$SmsBroadcastReceiver@4b6602e that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(11979): android.app.IntentReceiverLeaked: Activity com.example.sms.MainActivity has leaked IntentReceiver com.jaumard.smsautofill.SmsAutoFillPlugin$SmsBroadcastReceiver@4b6602e that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(11979): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1498) E/ActivityThread(11979): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1226) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1601) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1574) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1562) E/ActivityThread(11979): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:603) E/ActivityThread(11979): at com.jaumard.smsautofill.SmsAutoFillPlugin$2.onSuccess(SmsAutoFillPlugin.java:104) E/ActivityThread(11979): at com.jaumard.smsautofill.SmsAutoFillPlugin$2.onSuccess(SmsAutoFillPlugin.java:100) E/ActivityThread(11979): at com.google.android.gms.tasks.zzn.run(Unknown Source:4) E/ActivityThread(11979): at android.os.Handler.handleCallback(Handler.java:808) E/ActivityThread(11979): at android.os.Handler.dispatchMessage(Handler.java:101) E/ActivityThread(11979): at android.os.Looper.loop(Looper.java:166) E/ActivityThread(11979): at android.app.ActivityThread.main(ActivityThread.java:7529) E/ActivityThread(11979): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(11979): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) E/ActivityThread(11979): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) E/ActivityThread(11979): Activity com.example.sms.MainActivity has leaked IntentReceiver com.jaumard.smsautofill.SmsAutoFillPlugin$SmsBroadcastReceiver@7f3d2a9 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(11979): android.app.IntentReceiverLeaked: Activity com.example.sms.MainActivity has leaked IntentReceiver com.jaumard.smsautofill.SmsAutoFillPlugin$SmsBroadcastReceiver@7f3d2a9 that was originally registered here. Are you missing a call to unregisterReceiver()? E/ActivityThread(11979): at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1498) E/ActivityThread(11979): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1226) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1601) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1574) E/ActivityThread(11979): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1562) E/ActivityThread(11979): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:603) E/ActivityThread(11979): at com.jaumard.smsautofill.SmsAutoFillPlugin$2.onSuccess(SmsAutoFillPlugin.java:104) E/ActivityThread(11979): at com.jaumard.smsautofill.SmsAutoFillPlugin$2.onSuccess(SmsAutoFillPlugin.java:100) E/ActivityThread(11979): at com.google.android.gms.tasks.zzn.run(Unknown Source:4) E/ActivityThread(11979): at android.os.Handler.handleCallback(Handler.java:808) E/ActivityThread(11979): at android.os.Handler.dispatchMessage(Handler.java:101) E/ActivityThread(11979): at android.os.Looper.loop(Looper.java:166) E/ActivityThread(11979): at android.app.ActivityThread.main(ActivityThread.java:7529) E/ActivityThread(11979): at java.lang.reflect.Method.invoke(Native Method) E/ActivityThread(11979): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) E/ActivityThread(11979): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

theAkshay60 commented 3 years ago

Yup this happened with me as well. I did unregister though.