Skip to content

Commit

Permalink
Merge pull request #340 from nicolas-f/gps_policy
Browse files Browse the repository at this point in the history
Reactivate background measurements
  • Loading branch information
nicolas-f authored Mar 18, 2021
2 parents 5855eee + 873e5ec commit 8c77cd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId "org.noise_planet.noisecapture"
minSdkVersion 15
targetSdkVersion 29
versionCode 53
versionName "1.2.17"
versionCode 54
versionName "1.2.18"
// Store build date in apk
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
buildConfigField "String", "GITHASH", "\"${getCheckedOutGitCommitHash().toString()}\""
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!-- Let you shutdown the screen while still measuring -->

<!-- Required by Android P -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ protected boolean checkAndAskPermissions() {
R.string.permission_explain_gps, Toast.LENGTH_LONG).show();
}
// Request the permission.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.RECORD_AUDIO,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.FOREGROUND_SERVICE,
Manifest.permission.ACCESS_BACKGROUND_LOCATION},
PERMISSION_RECORD_AUDIO_AND_GPS);
} else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.RECORD_AUDIO,
Manifest.permission.ACCESS_FINE_LOCATION,
Expand Down

0 comments on commit 8c77cd3

Please sign in to comment.