Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

Seems to conflict with flutter_simple_permissions #37

Open
zachgrayio opened this issue Oct 15, 2018 · 8 comments
Open

Seems to conflict with flutter_simple_permissions #37

zachgrayio opened this issue Oct 15, 2018 · 8 comments

Comments

@zachgrayio
Copy link

zachgrayio commented Oct 15, 2018

When attempting to use the sms library alongside simple_permissions (https://pub.dartlang.org/packages/simple_permissions), the app crashes as soon as sms initializes.

To reproduce, simply install simple_permissions to the sms example app and request a permission.

@babariviere
Copy link
Owner

Hi, are you requesting SMS permission with simple_permissions?

@zachgrayio
Copy link
Author

@babariviere - nope, I'm just trying to get READ/WRITE access to external storage.

@babariviere
Copy link
Owner

Do you have any log?

@zachgrayio
Copy link
Author

Sure, I'll fire that branch back up now

@zachgrayio
Copy link
Author

So, what's interesting is that when I implemented simple_permissions, I'd already allowed the sms permissions so they were saved for the app and it didn't ask again; my live-reloads and even full launches of the app were fine until I uninstalled the app entirely and sms needed to request perms again.

At this point, the app boots OK, and then sms requests permissions and the android native dialog appears asking for access to phone - when I click allow, the app crashes with the following (notice it's actually simple_permissions crashing even though that code hasn't been called directly yet):

[{"event":"app.started","params":{"appId":"59ea5f7b-2c74-4fd1-818e-26fed2f76323"}}]
[  +40 ms] I/SimplePermission(23176): Requesting permission status : 0
[        ] D/AndroidRuntime(23176): Shutting down VM
[        ] E/AndroidRuntime(23176): FATAL EXCEPTION: main
[        ] E/AndroidRuntime(23176): Process: com.example.app.host, PID: 23176
[        ] E/AndroidRuntime(23176): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=6, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.example.app.host/com.example.app.host.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference
[        ] E/AndroidRuntime(23176): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4360)
[        ] E/AndroidRuntime(23176): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
[        ] E/AndroidRuntime(23176): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
[        ] E/AndroidRuntime(23176): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[        ] E/AndroidRuntime(23176): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[        ] E/AndroidRuntime(23176): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[        ] E/AndroidRuntime(23176): 	at android.os.Handler.dispatchMessage(Handler.java:106)
[        ] E/AndroidRuntime(23176): 	at android.os.Looper.loop(Looper.java:193)
[        ] E/AndroidRuntime(23176): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
[        ] E/AndroidRuntime(23176): 	at java.lang.reflect.Method.invoke(Native Method)
[        ] E/AndroidRuntime(23176): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[        ] E/AndroidRuntime(23176): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[        ] E/AndroidRuntime(23176): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference
[        ] E/AndroidRuntime(23176): 	at com.ethras.simplepermissions.SimplePermissionsPlugin.onRequestPermissionsResult(SimplePermissionsPlugin.java:172)
[        ] E/AndroidRuntime(23176): 	at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:191)
[        ] E/AndroidRuntime(23176): 	at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:125)
[        ] E/AndroidRuntime(23176): 	at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:133)
[        ] E/AndroidRuntime(23176): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7608)
[        ] E/AndroidRuntime(23176): 	at android.app.Activity.dispatchActivityResult(Activity.java:7458)
[        ] E/AndroidRuntime(23176): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
[        ] E/AndroidRuntime(23176): 	... 11 more
[  +30 ms] I/Process (23176): Sending signal. PID: 23176 SIG: 9

@zachgrayio
Copy link
Author

I'm thinking the sms plugin's native code is overwriting the simple_permissions channel perhaps?

@babariviere
Copy link
Owner

Yes I think as we have 2 different listener for permission, it cannot choose which one to use

@zachgrayio
Copy link
Author

I wonder how much work it would be to make use of simple permissions to request permissions in sms to avoid a conflict

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

2 participants