-
-
Notifications
You must be signed in to change notification settings - Fork 876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to detect current Android Activity., null, null #552
Comments
@Ronadlo7 could you please provide more details?
Most likely you are calling the |
Android depand on Flutter module ,flutter module depand on permission_handler: ^7.1.0, |
Can you provide a reproduction example? |
Can you provide contact information? provide example project? [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(PermissionHandler.PermissionManager, Unable to detect current Android Activity., null, null) |
@Ronadlo7 the easiest would be to create a GitHub gist. But if this is difficult you can drop an email to dev(at)baseflow.com |
ok,Sending a example project to your email of Sending to your mailbox |
It has been sent successfully, have you received it? |
I received the file, downloading it and will have a look when I get some time. Maybe for future reference, run a |
How is it, has it reproduced? |
Hi @Ronadlo7, I've received the flutter project you're working on to help you with this issue.
But I did notice that the permission was not added in the AndroidManifest.xml, which is mandatory if you want to ask permission to the user. In your project folder structure go to If you open the AndroidManifest you should add the following line: Clear instruction on how to set the permission handler up can be found here. A full list of all the permission that are available can be found here. This is the AndroidManifest.xml from the example app which is included in the permission_handler plugin, you can always check the example app to see how it works! I hope this will help you, please let us know if the issue is solved or not. |
I have add the permission in AndroidManifest.xml . |
you run Android project ,not flutter module ,because if you run flutter module is ok, this error is run Android project |
I'm not entirely sure what you mean, but I've opened the project using the flutter_module_support folder, and I've opened the project using the Android folder. Both will run perfectly after adding the permission.
Just to be sure it's not a weird flutter/package issue, have you ran If it did not help, can you explain the steps you take from the beginning (opening the project, and how you run the project and test the project and so on)? Because I can't seem to reproduce the issue |
you should be run AndroidToFlutter project ,not flutter_module_support folder , |
AndroidToFlutter is Android Project ,it depend on flutter_module_support, so you should be run AndroidToFlutter Project ,then it have the problem |
there are three java file ,you shoule be replece: 2.NativeActivity.java 3.TransitionActivity.java |
now ,you can try again, |
I did manage to get the app running now, but I still don't get the same error down here you get when I click on one of those 2 buttons.
This error shows that there is no Activity, so I think something goes wrong starting the intent where you ask for the permission. I saw you took step one, but I did not see calling the intents as mentioned in step 2. I think if you succesfully call an intent the way the tutorial shows that the permission_handler will have an activity and the permission request will work. |
you also get this error? add FlutterView by TransitionActivity you can new Android Project by yourself ,then depend on flutter module, See if there is such an error |
Hi @Ronadlo7, It took me a while because I had some troubles with my pc, but I figured out what the problem is. In your method you do the following to start an intent:
This way you do start an Intent, opening one of the screens you have made in Flutter, but the Activity will be null. The way how you should start the activity is like this:
This is how you start a FlutterActivity, this way asking for the permission will work if you have added it to the AndroidManifest because the activity won't be null this way. The issue is closed, but if it still doesn't work let me know! |
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(PermissionHandler.PermissionManager, Unable to detect current Android Activity., null, null)
The text was updated successfully, but these errors were encountered: