Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add runtime permission check
  • Loading branch information
hannesa2 committed Jul 31, 2021
commit 1f2b086e36c5174fefc1fd63df6e54cffb49a996
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ android {

dependencies {
implementation 'com.jakewharton:butterknife:5.1.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0'
implementation project(':FFmpegAndroid')

implementation 'com.android.support:support-v13:28.0.0'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.github.hiteshsondhi88.sampleffmpeg" >

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.github.hiteshsondhi88.sampleffmpeg;

import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
Expand All @@ -25,6 +28,7 @@

public class Home extends Activity implements View.OnClickListener {

private static final int REQUEST_CODE = 100;
private static final String TAG = Home.class.getSimpleName();

public FFmpeg ffmpeg;
Expand All @@ -48,6 +52,10 @@ protected void onCreate(Bundle savedInstanceState) {

loadFFMpegBinary();
initUI();

if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_CODE);
}
}

private void initUI() {
Expand Down Expand Up @@ -131,7 +139,6 @@ public void onClick(DialogInterface dialog, int which) {
})
.create()
.show();

}

@Override
Expand Down