aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2020-10-12 20:56:59 -0700
committerScott Jackson <daneren2005@gmail.com>2020-10-12 20:56:59 -0700
commit28cf757952f789896bf8e8b5174947b03942f792 (patch)
tree7ca5afad5b7da2e66955fd99230a7c899972dfdc /app/src/main/java/github
parent1efb5b3df99c7a5fc87cb025aa5850f101cbf6ce (diff)
downloaddsub-28cf757952f789896bf8e8b5174947b03942f792.tar.gz
dsub-28cf757952f789896bf8e8b5174947b03942f792.tar.bz2
dsub-28cf757952f789896bf8e8b5174947b03942f792.zip
Request location permissions on every startup if not given
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java13
1 files changed, 12 insertions, 1 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();
}
}
}