Skip to content

Commit

Permalink
Permissions for older phones
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Nov 28, 2023
1 parent 200a884 commit 9aded6e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jni_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ extern "C" JNIEXPORT jboolean JNICALL Java_com_panda3ds_pandroid_AlberDriver_Has

extern "C" JNIEXPORT void JNICALL Java_com_panda3ds_pandroid_AlberDriver_LoadRom(JNIEnv* env, jobject obj, jstring path) {
const char* pathStr = env->GetStringUTFChars(path, nullptr);
__android_log_print(ANDROID_LOG_INFO, "AlberDriver", "Loading ROM %s", pathStr);
romLoaded = emulator->loadROM(pathStr);
__android_log_print(ANDROID_LOG_INFO, "AlberDriver", "Loading ROM %s, result: %d", pathStr, (int)romLoaded);
env->ReleaseStringUTFChars(path, pathStr);
}

Expand Down
3 changes: 3 additions & 0 deletions src/pandroid/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>

<uses-feature
android:required="true"
android:glEsVersion="0x0030002"/>

<application
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@

import androidx.appcompat.app.AppCompatActivity;

import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
import androidx.core.app.ActivityCompat;

import com.panda3ds.pandroid.utils.Constants;
import com.panda3ds.pandroid.R;
import com.panda3ds.pandroid.utils.PathUtils;

public class MainActivity extends BaseActivity {
private static final int PICK_3DS_ROM = 2;
private static final int PERMISSION_REQUEST_CODE = 3;

private void openFile() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
Expand All @@ -32,6 +37,9 @@ protected void onCreate(Bundle savedInstanceState) {
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
startActivity(intent);
}
} else {
ActivityCompat.requestPermissions(this, new String[]{READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
}

setContentView(R.layout.activity_main);
Expand Down

0 comments on commit 9aded6e

Please sign in to comment.