mirror of
https://github.com/home-assistant/android
synced 2024-07-22 19:04:20 +00:00
Breaking Change: Add some more attributes to geocoded sensor and check that device supports it (#2809)
* Add some more attributes to geocoded sensor and check that device supports it * Remove language attribute as it does not supply the expected data * Combine latitude and longitude into the location attribute again
This commit is contained in:
parent
d00c823651
commit
db8913c712
|
@ -40,6 +40,10 @@ class GeocodeSensorManager : SensorManager {
|
|||
return listOf(geocodedLocation)
|
||||
}
|
||||
|
||||
override fun hasSensor(context: Context): Boolean {
|
||||
return Geocoder.isPresent()
|
||||
}
|
||||
|
||||
override fun requiredPermissions(sensorId: String): Array<String> {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
arrayOf(
|
||||
|
@ -99,13 +103,16 @@ class GeocodeSensorManager : SensorManager {
|
|||
"country" to it.countryName,
|
||||
"iso_country_code" to it.countryCode,
|
||||
"locality" to it.locality,
|
||||
"latitude" to it.latitude,
|
||||
"longitude" to it.longitude,
|
||||
"location" to listOf(it.latitude, it.longitude),
|
||||
"name" to it.featureName,
|
||||
"phone" to it.phone,
|
||||
"premises" to it.premises,
|
||||
"postal_code" to it.postalCode,
|
||||
"sub_administrative_area" to it.subAdminArea,
|
||||
"sub_locality" to it.subLocality,
|
||||
"sub_thoroughfare" to it.subThoroughfare,
|
||||
"thoroughfare" to it.thoroughfare
|
||||
"thoroughfare" to it.thoroughfare,
|
||||
"url" to it.url
|
||||
)
|
||||
}.orEmpty()
|
||||
|
||||
|
|
Loading…
Reference in a new issue