位置情報をOnかOffを判断
kotlin.kt
private fun isLocationEnabled(): Boolean {
val locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
return LocationManagerCompat.isLocationEnabled(locationManager)
}
オンならtrueオフならfalseが返ってきます