Skip to content

Commit

Permalink
android 13 permission issue backport for 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
basyskom-bmeier committed Oct 10, 2023
1 parent 42b8667 commit 0a33abd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
compileSdkVersion 33
buildToolsVersion "30.0.0"

defaultConfig {
applicationId "com.gowtham.videotrimmer"
minSdkVersion 19
targetSdkVersion 29
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.gowtham.videotrimmer">

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/com/gowtham/videotrimmer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -224,8 +225,18 @@ private long getEdtValueLong(EditText editText) {
}

private boolean checkCamStoragePer() {
return checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA);
// return checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
// Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
return checkPermission(
Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.CAMERA);
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return checkPermission(
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.CAMERA);
} else
return checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.CAMERA);
}

private boolean checkPermission(String... permissions) {
Expand Down
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 30
compileSdkVersion 33
buildToolsVersion "30.0.0"

defaultConfig {
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,13 @@ private void showProcessingDialog() {
}

private boolean checkStoragePermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
{
return checkPermission(
Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.ACCESS_MEDIA_LOCATION);
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.ACCESS_MEDIA_LOCATION);
} else
Expand Down

0 comments on commit 0a33abd

Please sign in to comment.