100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Location permission will not be asked automatically after first initialization
Michael Rademaker46838ea1e984
diff --git a/console/android/src/main/java/org/openremote/android/service/GeofenceProvider.kt b/console/android/src/main/java/org/openremote/android/service/GeofenceProvider.ktindex 314110636..e89b38600 100644--- a/console/android/src/main/java/org/openremote/android/service/GeofenceProvider.kt+++ b/console/android/src/main/java/org/openremote/android/service/GeofenceProvider.kt@@ -39,12 +39,14 @@ class GeofenceProvider(val context: Context) : ActivityCompat.OnRequestPermissio}companion object {+ val locationPermissionAskedKey = "LocationPermissionAsked"val baseUrlKey = "baseUrl"val consoleIdKey = MainActivity.CONSOLE_ID_KEYval geofencesKey = "geofences"val geofenceDisabledKey = "geofenceDisabled"- var locationReponseCode = 101- var JSON = ObjectMapper()+ val locationReponseCode = 101++ val JSON = ObjectMapper()val LOG = Logger.getLogger(GeofenceProvider::class.java.name)fun getGeofences(context: Context): Array<GeofenceDefinition> {@@ -186,7 +188,8 @@ class GeofenceProvider(val context: Context) : ActivityCompat.OnRequestPermissio.remove(geofenceDisabledKey).apply()- if (ContextCompat.checkSelfPermission(context, ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {+ if (ContextCompat.checkSelfPermission(context, ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && !sharedPreferences.getBoolean(locationPermissionAskedKey, false)) {+ sharedPreferences.edit().putBoolean(locationPermissionAskedKey, true).apply()enableCallback = callbackregisterPermissions(activity)return