Skip to content

Commit

Permalink
Grant camera write permissions, remove obsolete permissions (Fix labe…
Browse files Browse the repository at this point in the history
  • Loading branch information
Zahnstocher committed Jul 31, 2024
1 parent d1092f2 commit d563842
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 1 addition & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- External storage permissions -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:description="@string/app_description"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/HighContrast"
android:requestLegacyExternalStorage="true">
android:theme="@style/HighContrast">

<uses-library
android:name="org.apache.http.legacy"
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/net/osmtracker/activity/TrackLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
Expand Down Expand Up @@ -800,8 +801,13 @@ public long getCurrentTrackId() {
private void startCamera(File imageFile) {
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());

Uri imageUriContent = FileProvider.getUriForFile(this,
DataHelper.FILE_PROVIDER_AUTHORITY, imageFile);

Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
cameraIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUriContent);
startActivityForResult(cameraIntent, REQCODE_IMAGE_CAPTURE);
}

Expand Down

0 comments on commit d563842

Please sign in to comment.