diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bdc5ceb..96726dc0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: build on: [push, pull_request] jobs: - build: + build-android: runs-on: ubuntu-latest steps: - name: Setup Java 8 diff --git a/love/src/main/java/org/love2d/android/GameActivity.java b/love/src/main/java/org/love2d/android/GameActivity.java index 730d3361..57f9734d 100644 --- a/love/src/main/java/org/love2d/android/GameActivity.java +++ b/love/src/main/java/org/love2d/android/GameActivity.java @@ -91,9 +91,7 @@ public class GameActivity extends SDLActivity { storagePermissionUnnecessary = false; embed = context.getResources().getBoolean(R.bool.embed); - if (!embed) { - handleIntent(this.getIntent()); - } + handleIntent(this.getIntent()); super.onCreate(savedInstanceState); getWindowManager().getDefaultDisplay().getMetrics(metrics); @@ -116,7 +114,7 @@ public class GameActivity extends SDLActivity { protected void handleIntent(Intent intent) { Uri game = intent.getData(); - if (game != null) { + if (!embed && game != null) { String scheme = game.getScheme(); String path = game.getPath(); // If we have a game via the intent data we we try to figure out how we have to load it. We @@ -172,7 +170,8 @@ public class GameActivity extends SDLActivity { alert_dialog.create().show(); } } else { - // No game specified via the intent data -> check whether we have a game.love in our assets. + // No game specified via the intent data or embed build is used. + // Check whether we have a game.love in our assets. boolean game_love_in_assets = false; try { List assets = Arrays.asList(getAssets().list("")); @@ -209,14 +208,17 @@ public class GameActivity extends SDLActivity { protected void checkLovegameFolder() { // If no game.love was found fall back to the game in /lovegame - Log.d("GameActivity", "fallback to lovegame folder"); - if (hasExternalStoragePermission()) { - File ext = Environment.getExternalStorageDirectory(); - if ((new File(ext, "/lovegame/main.lua")).exists()) { - gamePath = ext.getPath() + "/lovegame/"; + // if using normal or playstore build + if (!embed) { + Log.d("GameActivity", "fallback to lovegame folder"); + if (hasExternalStoragePermission()) { + File ext = Environment.getExternalStorageDirectory(); + if ((new File(ext, "/lovegame/main.lua")).exists()) { + gamePath = ext.getPath() + "/lovegame/"; + } + } else { + Log.d("GameActivity", "Cannot load game from /sdcard/lovegame: permission not granted"); } - } else { - Log.d("GameActivity", "Cannot load game from /sdcard/lovegame: permission not granted"); } }