Ahmad Naser Turnkey Ecosystem Ahmad Naser
June 24, 2019

Check permission in android with kotlin

Published in the Ahmad Naser ecosystem. Estimated reading time: 1 minute.

   var ACCESSLOCATIONREQUESTCODE=200
    private fun permissionCheck() {
        if (Build.VERSION.SDK_INT>=23){
            if (ActivityCompat.checkSelfPermission(this,android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED){
               requestPermissions(arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION),ACCESSLOCATIONREQUESTCODE)
                return

            }
        }

        GetCurrentLocation()
    }

Leave a Reply

Your email address will not be published. Required fields are marked *