Skip to content

Commit

Permalink
add google play compliance (wuan#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan authored May 25, 2021
1 parent fdb1194 commit a795932
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
applicationId "org.blitzortung.android.app"
minSdkVersion 15
targetSdkVersion 30
versionCode 278
versionCode 279
versionName '2.1.7'
multiDexEnabled false
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
46 changes: 31 additions & 15 deletions app/src/main/java/org/blitzortung/android/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,22 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {
val requestCode = (LocationProviderRelation.byProviderName[locationProviderName]?.ordinal
?: Int.MAX_VALUE)
if (requiresPermission) {
requestPermission(if (requiresBackgroundPermission) {
arrayOf(permission, ACCESS_BACKGROUND_LOCATION)
} else {
arrayOf(permission)
},
requestCode,
if (requiresBackgroundPermission) R.string.location_permission_background_required else R.string.location_permission_required
)
val locationText = resources.getString(R.string.location_permission_background_disclosure)
AlertDialog.Builder(this)
.setMessage(locationText)
.setCancelable(false)
.setNeutralButton(android.R.string.ok) { dialog, count ->
requestPermission(
if (requiresBackgroundPermission) {
arrayOf(permission, ACCESS_BACKGROUND_LOCATION)
} else {
arrayOf(permission)
},
requestCode,
if (requiresBackgroundPermission) R.string.location_permission_background_required else R.string.location_permission_required
)
}
.show()
} else {
if (requiresBackgroundPermission) {
requestPermission(arrayOf(ACCESS_BACKGROUND_LOCATION), requestCode, R.string.location_permission_background_required)
Expand Down Expand Up @@ -616,13 +624,21 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {
when (which) {
DialogInterface.BUTTON_POSITIVE -> {
Log.v(LOG_TAG, "requestWakeupPermissions() request ignore battery optimizations")
val intent = Intent()
intent.action = Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS
try {
startActivity(intent)
} catch (e: AndroidRuntimeException) {
Toast.makeText(baseContext, R.string.background_query_toast, Toast.LENGTH_LONG).show()
Log.e(LOG_TAG, "requestWakeupPermissions() could not open battery optimization settings", e)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val intent = Intent()
intent.action = Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS

try {
startActivity(intent)
} catch (e: AndroidRuntimeException) {
Toast.makeText(baseContext, R.string.background_query_toast, Toast.LENGTH_LONG)
.show()
Log.e(
LOG_TAG,
"requestWakeupPermissions() could not open battery optimization settings",
e
)
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,7 @@ Ruský překlad: Ivan Karev ([email protected])\n
<string name="alarm_vibration_signal_summary">Vyber délku vibrací signalizace alarmu</string>
<string name="location_provider_not_available">Poskytovatel polohy \'%s\' není dostupný</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">Při použití zdroje umístění zařízení je vyžadováno oprávnění k poloze.</string>
<string name="location_permission_background_required">Při použití zdroje umístění zařízení je vyžadováno oprávnění k umístění na pozadí.</string>
<string name="location_permission_background_disclosure">Tato aplikace používá údaje o poloze, i když je aplikace zavřená nebo se nepoužívá při použití alarmů na pozadí se zdrojem polohy zařízení.</string>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ Ivan Karev ([email protected])\nTschechisch: Jakub Mareček (jakubmarecek715@
<string name="legend_grid">Raster</string>
<string name="map_scale">Kartenskalierung</string>
<string name="map_scale_summary">Skalierung der Kartenkacheln [%]</string>
<string name="location_permission_required">Für die Ortsbestimmung ist die Berechtigung für den Zugriff auf den Gerätestandort erforderlich.</string>
<string name="location_permission_background_required">Für die Ortsbestimmung bei Warnungen im Hintergrund ist die Berechtigung für den Zugriff auf den Gerätestandort im Hintergrund erforderlich.</string>
<string name="location_permission_required">Für die Ortsbestimmung über den Gerätestandort ist die Berechtigung erforderlich.</string>
<string name="location_permission_background_required">Für die Ortsbestimmung über den Gerätestandort im Hintergrund ist die Berechtigung erforderlich.</string>
<string name="changelog">Änderungsprotokoll</string>
<string name="location_permission_background_disclosure">Diese App verwendet Standortdaten, auch wenn die App geschlossen ist oder nicht verwendet wird, wenn Warnungen im Hintergrund mit einer Gerätestandortquelle verwendet werden.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,7 @@ Traducción ruso por: Ivan Karev ([email protected])\n
<string name="share_log">Enviar correo electrónico…</string>
<string name="share_unavailable">No es posible compartir por correo electrónico</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">Se requiere permiso de ubicación cuando se usa una fuente de ubicación de dispositivo.</string>
<string name="location_permission_background_required">Se requiere permiso de ubicación en segundo plano cuando se utiliza una fuente de ubicación de dispositivo.</string>
<string name="location_permission_background_disclosure">Esta aplicación usa datos de ubicación incluso cuando la aplicación está cerrada o no está en uso cuando se usan alarmas en segundo plano con una fuente de ubicación del dispositivo.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,7 @@ Russe: Ivan Karev ([email protected])\n
<string name="map_scale">Échelle de la carte</string>
<string name="own_location">Votre emplacement</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">L\'autorisation de localisation est requise lors de l\'utilisation d\'une source de localisation de périphérique.</string>
<string name="location_permission_background_required">L\'autorisation de localisation en arrière-plan est requise lors de l\'utilisation d\'une source de localisation de périphérique.</string>
<string name="location_permission_background_disclosure">Cette application utilise les données de localisation même lorsque l\'application est fermée ou non utilisée lors de l\'utilisation d\'alarmes d\'arrière-plan avec une source de localisation de périphérique.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,7 @@ Ruski: Ivan Karev ([email protected])\n
<string name="keep_zoom_goto_own_location_summary">Zadrži trenutno zumiranje pri centriranju vlastite lokacije</string>
<string name="keep_zoom_goto_own_location_title">Zadrži zumiranje</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">Dopuštenje za lokaciju potrebno je kada se koristi izvor lokacije uređaja.</string>
<string name="location_permission_background_required">Dopuštenje za pozadinsko mjesto potrebno je kada se koristi izvor lokacije uređaja.</string>
<string name="location_permission_background_disclosure">Ova aplikacija upotrebljava podatke o lokaciji čak i kada je aplikacija zatvorena ili se ne koristi kada upotrebljava pozadinske alarme s izvorom lokacije uređaja.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,7 @@ Traduzione russo di: Ivan Karev ([email protected])\n
<string name="share_log">Invia email…</string>
<string name="share_unavailable">La condivisione tramite email non è disponibile.</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">L\'autorizzazione alla posizione è richiesta quando si utilizza un\'origine della posizione del dispositivo.</string>
<string name="location_permission_background_required">L\'autorizzazione alla posizione in background è necessaria quando si utilizza un\'origine della posizione del dispositivo.</string>
<string name="location_permission_background_disclosure">Questa app utilizza i dati sulla posizione anche quando l\'app è chiusa o non è in uso quando si utilizzano allarmi in background con un\'origine della posizione del dispositivo.</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,6 @@ Russisch: Ivan Karev ([email protected])\n
<string name="map_scale_summary">Selecteer schaling [%] voor kaart</string>
<string name="location_permission_required">Locatie delen is nodig om je huidige locatie te bepalen.</string>
<string name="changelog">Change log</string>
<string name="location_permission_background_required">Achtergrondlocatietoestemming is vereist bij het gebruik van een apparaatlocatiebron.</string>
<string name="location_permission_background_disclosure">Deze app gebruikt locatiegegevens, zelfs wanneer de app is gesloten of niet in gebruik is, wanneer achtergrondalarmen worden gebruikt met een apparaatlocatiebron.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,7 @@ Tłumaczenie rosyjski: Ivan Karev ([email protected])\n
<string name="service_url_summary">Zmienia domyślny adres URL bazy danych</string>
<string name="set_manual_location">Ustawiono ręczną pozycję</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">W przypadku korzystania ze źródła lokalizacji urządzenia wymagane jest pozwolenie na lokalizację.</string>
<string name="location_permission_background_required">W przypadku korzystania ze źródła lokalizacji urządzenia wymagane jest zezwolenie na lokalizację w tle.</string>
<string name="location_permission_background_disclosure">Ta aplikacja korzysta z danych o lokalizacji nawet wtedy, gdy jest zamknięta lub nieużywana podczas korzystania z alarmów w tle ze źródłem lokalizacji urządzenia.</string>
</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ Russian by Ivan Karev ([email protected])\n
<string name="unit_miles">миль</string>
<string name="map_scale">Масштаб карты</string>
<string name="map_scale_summary">Выберите процент масштабирования тайлов карты</string>
<string name="location_permission_required">Требуется разрешение определения Вашего месторасположения.</string>
<string name="location_permission_required">Разрешение местоположения требуется при использовании источника местоположения устройства.</string>
<string name="changelog">Список изменений</string>
<string name="location_permission_background_required">Разрешение фонового определения местоположения требуется при использовании источника местоположения устройства.</string>
<string name="location_permission_background_disclosure">Это приложение использует данные о местоположении, даже когда приложение закрыто или не используется, при использовании фоновых сигналов тревоги с источником местоположения устройства.</string>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,7 @@ Ruský preklad: Ivan Karev ([email protected])\n
<string name="keep_zoom_goto_own_location_summary" >Nastavenie pre udržanie aktuálneho priblíženia pri centrovaní na vlastnú polohu</string>
<string name="keep_zoom_goto_own_location_title" >Udržať priblíženie</string>
<string name="changelog">Change log</string>
<string name="location_permission_required">Pri použití zdroja polohy zariadenia je potrebné povolenie na umiestnenie.</string>
<string name="location_permission_background_required">Pri použití zdroja umiestnenia zariadenia je potrebné povolenie na umiestnenie na pozadí.</string>
<string name="location_permission_background_disclosure">Táto aplikácia používa údaje o polohe, aj keď je aplikácia zatvorená alebo sa nepoužíva, keď používate budíky na pozadí so zdrojom polohy zariadenia.</string>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ Russian by Ivan Karev ([email protected])\n
<string name="unit_miles">mi.</string>
<string name="map_scale">Map scale</string>
<string name="map_scale_summary">Select scaling [%] of map tiles</string>
<string name="location_permission_required">Location permission is required to for device location source.</string>
<string name="location_permission_background_required">Background location permission is required if you have enabled background alarms with a device location source.</string>
<string name="location_permission_required">Location permission is required when using a device location source.</string>
<string name="location_permission_background_required">Background location permission is required when using a device location source.</string>
<string name="location_permission_background_disclosure">This app uses location data even when the app is closed or not in use when using background alarms with a device location source.</string>
<string name="osmdroid_storage_warning">Cannot find writable storage for map. Please report.</string>
<string name="changelog">Change log</string>
</resources>

0 comments on commit a795932

Please sign in to comment.