ParkSangGwon / TedPermission

Easy check permission library for Android Marshmallow
1.74k stars 239 forks source link

when will you provide android "Q" support? #102

Closed hardikpatel679 closed 5 years ago

hardikpatel679 commented 5 years ago

when will you provide android "Q" support?

ParkSangGwon commented 5 years ago

What is issue at android Q?

Maxwell6635 commented 5 years ago

I believe Android Q is change on permission request on location.

https://android-developers.googleblog.com/2019/06/android-q-beta-4-and-final-apis.html

ParkSangGwon commented 5 years ago

@hardikpatel679 @Maxwell6635 There are no issue for permission flow You can 2 choice

And then you can check your permission. Check this link https://developer.android.com/preview/privacy/device-location#kotlin

This is example of this permission-checking logic appears in the following code snippet:

val permissionAccessCoarseLocationApproved = ActivityCompat
    .checkSelfPermission(this, permission.ACCESS_COARSE_LOCATION) ==
    PackageManager.PERMISSION_GRANTED

if (permissionAccessCoarseLocationApproved) {
   val backgroundLocationPermissionApproved = ActivityCompat
       .checkSelfPermission(this, permission.ACCESS_BACKGROUND_LOCATION) ==
       PackageManager.PERMISSION_GRANTED

   if (backgroundLocationPermissionApproved) {
       // App can access location both in the foreground and in the background.
       // Start your service that doesn't have a foreground service type
       // defined.
   } else {
       // App can only access location in the foreground. Display a dialog
       // warning the user that your app must have all-the-time access to
       // location in order to function properly. Then, request background
       // location.
       ActivityCompat.requestPermissions(this,
           arrayOf(Manifest.permission.ACCESS_BACKGROUND_LOCATION),
           your-permission-request-code
       )
   }
} else {
   // App doesn't have access to the device's location at all. Make full request
   // for permission.
   ActivityCompat.requestPermissions(this,
       arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION,
               Manifest.permission.ACCESS_BACKGROUND_LOCATION),
       your-permission-request-code
   )
}