mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
[Android] Android 11+ mandatory use of app-specific directory (obb)
- before migration to obb folder, run Forge first and let it download and install necessary files. If Forge is not running (after Android 11 update, white screen bug), disable storage permission and enable storage permission again for Forge. After succesful run, exit Forge then copy your existing Forge folder to Android/obb/forge.app (as suggested by CptKird).
This commit is contained in:
@@ -55,6 +55,7 @@ import forge.util.FileUtil;
|
||||
import forge.util.ThreadUtil;
|
||||
import io.sentry.Sentry;
|
||||
import io.sentry.android.AndroidSentryClientFactory;
|
||||
import io.sentry.event.BreadcrumbBuilder;
|
||||
|
||||
public class Main extends AndroidApplication {
|
||||
AndroidAdapter Gadapter;
|
||||
@@ -215,21 +216,28 @@ public class Main extends AndroidApplication {
|
||||
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||
//fake init for error message
|
||||
//set current orientation
|
||||
String message = getDeviceName()+"\n"+"Android "+AndroidRelease+"\n"+"RAM "+ totalRAM+"MB" +"\n"+"LibGDX "+ Version.VERSION+"\n"+"Can't access external storage";
|
||||
Sentry.getContext().recordBreadcrumb(
|
||||
new BreadcrumbBuilder().setMessage(message).build()
|
||||
);
|
||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName()));
|
||||
displayMessage(adapter, true, getDeviceName()+"\n"+"Android "+AndroidRelease+"\n"+"RAM "+ totalRAM+"MB" +"\n"
|
||||
+"LibGDX "+ Version.VERSION+"\n"+"Can't access external storage");
|
||||
displayMessage(adapter, true, message);
|
||||
return;
|
||||
}
|
||||
String obbforge = Environment.getExternalStorageDirectory() + "/obbforge"; //if obbforge file exists in Phone Storage, use app-specific Obb directory as path
|
||||
String assetsDir = FileUtil.doesFileExist(obbforge) ? getContext().getObbDir()+"/Forge/" : Environment.getExternalStorageDirectory()+"/Forge/";
|
||||
String obbforge = Environment.getExternalStorageDirectory() + "/obbforge";
|
||||
//if obbforge file exists in Phone Storage, Forge uses app-specific Obb directory as path, Android 11+ is mandatory even without obbforge
|
||||
String assetsDir = (FileUtil.doesFileExist(obbforge) || Build.VERSION.SDK_INT > 29) ? getContext().getObbDir()+"/Forge/" : Environment.getExternalStorageDirectory()+"/Forge/";
|
||||
if (!FileUtil.ensureDirectoryExists(assetsDir)) {
|
||||
//fake init for error message
|
||||
//set current orientation
|
||||
String message = getDeviceName()+"\n"+"Android "+AndroidRelease+"\n"+"RAM "+ totalRAM+"MB" +"\n"+"LibGDX "+ Version.VERSION+"\n"+"Can't access external storage\nPath: " + assetsDir;
|
||||
Sentry.getContext().recordBreadcrumb(
|
||||
new BreadcrumbBuilder().setMessage(message).build()
|
||||
);
|
||||
Main.this.setRequestedOrientation(Main.this.getResources().getConfiguration().orientation);
|
||||
initialize(Forge.getApp(new AndroidClipboard(), adapter, "", false, true, totalRAM, isTabletDevice, AndroidAPI, AndroidRelease, getDeviceName()));
|
||||
displayMessage(adapter, true, getDeviceName()+"\n"+"Android "+AndroidRelease+"\n"+"RAM "+ totalRAM+"MB" +"\n"
|
||||
+"LibGDX "+ Version.VERSION+"\n"+"Can't access external storage\nPath: " + assetsDir);
|
||||
displayMessage(adapter, true, message);
|
||||
return;
|
||||
}
|
||||
boolean isPortrait;
|
||||
|
||||
Reference in New Issue
Block a user