Android M onRequestPermissionsResult in non-Activity

前端 未结 6 837
无人及你
无人及你 2020-12-29 03:52

I have an application which needs to find the user location, and location is fetched in various classes, so i have written a separate class(Not an Activity

6条回答
  •  别那么骄傲
    2020-12-29 04:17

    You can not override it. This method is only available for Activity and Fragments. But you can create a static method inside your Location class and call it from your activity/fragment's overridden onRequestPermissionResult method.

    I have made a custom implementation for Location combined with permission. You can also use a library called Let for permissions.

提交回复
热议问题