flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Overriding an onRequestPermissionsResult in Flutter application

Open vaimikpatel2908 opened this issue 3 years ago • 2 comments

💬 Hi there, I have a problem if anyone can help me take a look at here:

https://stackoverflow.com/questions/68304478/problem-overriding-onrequestpermissionsresult-along-with-permission-handler-plug

vaimikpatel2908 avatar Jul 08 '21 15:07 vaimikpatel2908

Hi @vaimikpatel2908, I've read the StackOverflow message you posted, but it's still not clear to me what you're trying to achieve. I would like to help you further, but to do that I need a more detailed description of the problem and code snippet/steps to reproduce the problem. Can you please provide

JDDV avatar Jul 15 '21 11:07 JDDV

Thanks for your response.

Unfortunately, on Stackoverflow, people just voted to delete the question before understanding or asking me to clear up the confusion if they did not get my question. And, as a result, the question got deleted from there and I had to create a workaround that is working fine but I can not get the result of the permission request because it just overrides the permission request result callbacks for the permission handler as well.

For reproducible code, you can try it by just creating a flutter app and just override an onRequestPermissionsResult in the MainActivity and try to request any permission using permission handler from flutter and it will freeze the code execution on permission request.

Actually, I have an android app that is working fine but we have a client who needs that app working on an android Garmin Fleet device as they are using it. I know if I make the native application that resolves the problem but I already have a flutter android app then If I can use existing code with little modification then It would be really easy to manage both the apps. Their Fleet API Library has some extra permissions which I need to request before accessing some APIs. For that, tried to use the method channels to communicate with native code from the flutter and override an onRequestPermissionsResult in MainActivity which hijacked result callbacks for all permission requests for the permission handler.

Overall, if I override the onRequestPermissionsResult in the MainActivity, the permission handler call for requesting permission waits forever. I wanted help to resolve it and find out an alternative way to implement it if there is. So, I can get the result of the permission request whether it is denied or allowed without affecting the permission handler's callbacks.

vaimikpatel2908 avatar Jul 27 '21 20:07 vaimikpatel2908

Closing this issue as there has been no activity in over 2 years. If you have a similar question, feel free to open a new issue, referencing this issue for context.

JeroenWeener avatar Aug 30 '23 15:08 JeroenWeener