Android: Request Permission

Edit

Ok, basically, overwrite the onRequestPermissionResult() function doesn’t do much thing…If you want to make user permission request, you just have to make a custom function and put the request permission code in it, then call this function in onCreate() or onCreateView()

Yesterday, I was trying to make location permissions request, and I discovered that the onRequestPermissionResult() method can neither be overwritten in Activities (which extends AppCompatActivity) nor Fragments.

I changed the current SDK version 29, to 28, sync the project, and hard-coded the onRequestPermissionResult() with @Override annotation, in order to see if this was the problem (I was once told that the API 29 is still volatile). However, the function was overridden without red underlines, but it didn’t work at all when I tested the app…So, I temporarily given up the default request permission method and started using RxPermission library instead.

It’s a bit weird, and for now I have no idea how this happened.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.