diff options
author | Scott Jackson <daneren2005@gmail.com> | 2020-10-12 20:56:59 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2020-10-12 20:56:59 -0700 |
commit | 28cf757952f789896bf8e8b5174947b03942f792 (patch) | |
tree | 7ca5afad5b7da2e66955fd99230a7c899972dfdc /app | |
parent | 1efb5b3df99c7a5fc87cb025aa5850f101cbf6ce (diff) | |
download | dsub-28cf757952f789896bf8e8b5174947b03942f792.tar.gz dsub-28cf757952f789896bf8e8b5174947b03942f792.tar.bz2 dsub-28cf757952f789896bf8e8b5174947b03942f792.zip |
Request location permissions on every startup if not given
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java | 13 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index 3b6935eb..d475be7b 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -18,6 +18,7 @@ */ package github.daneren2005.dsub.activity; +import android.Manifest; import android.app.UiModeManager; import android.content.Context; import android.content.DialogInterface; @@ -184,6 +185,17 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte if (ContextCompat.checkSelfPermission(this, permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{ permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } + + SharedPreferences prefs = Util.getPreferences(this); + int instance = prefs.getInt(Constants.PREFERENCES_KEY_SERVER_INSTANCE, 1); + String expectedSSID = prefs.getString(Constants.PREFERENCES_KEY_SERVER_LOCAL_NETWORK_SSID + instance, ""); + if(!expectedSSID.isEmpty()) { + String currentSSID = Util.getSSID(this); + + if(currentSSID == "<unknown ssid>" && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, SubsonicActivity.PERMISSIONS_REQUEST_LOCATION); + } + } } @Override @@ -204,7 +216,6 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte } else { Util.toast(this, R.string.permission_location_failed); - finish(); } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2dcee2d6..87ebbe07 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -669,7 +669,7 @@ <string name="details.home_page">Home Page</string> <string name="permission.external_storage.failed">DSub cannot function without the ability to write to storage</string> - <string name="permission.location.failed">This apps uses location data to get the WIFI SSID when the app is in use. No location data is collected.</string> + <string name="permission.location.failed">This apps uses location data to get the WIFI SSID to match against your local network settings. To get rid of this message, change the local network SSID to blank.</string> <plurals name="select_album_n_songs"> <item quantity="zero">No songs</item> |