Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launching love with activity manager #278

Closed
andreyorst opened this issue Sep 8, 2024 · 8 comments
Closed

launching love with activity manager #278

andreyorst opened this issue Sep 8, 2024 · 8 comments

Comments

@andreyorst
Copy link

Hello! This is more of a question, rather than an issue, but I don't see the discussion section in this project. Feel free to close this if it doesn't apply to the project's issue process.

LOVE 11.3 allowed to launch the app via the activity manager from Termux, like so:

am start -d "file:///sdcard/game.love" --user 0 org.love2d.android/.GameActivity

This was convenient when developing a game on the phone.

After updating to 11.5 this no longer works, due to Android sandboxing (I presume). However, there's now an additional LOVE Launcher, so I wonder if it is possible to use it in a similar way. Manually opening the packaged game.love file works fine, it's just a bit tedious, and I'd like to be able to automate this process.

Additionally, I noticed that while the LOVE is running, repeated calls to am with the -S flag didn't restart the app. I'm not sure if that's because I have no permission to restart the app, or because the Android build doesn't support this. As a result, previously opened LOVE had to be closed before running am again. It's a small hindrance, but it adds up over time while iterating on the game.

@MikuAuahDark
Copy link
Collaborator

MikuAuahDark commented Sep 8, 2024

Android bans the usage of file:// URI starting in Android 7, so unfortunately there will be no way of launching LOVE with specific .love file through activity manager anymore.

@MikuAuahDark MikuAuahDark closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2024
@radgeRayden
Copy link

The way I do it when developing with termux is to have a script that creates a love file, copies to accessible storage then uses xdg-open to launch the game with the launcher.

@andreyorst
Copy link
Author

@MikuAuahDark I see. It still works for me on Android 14 though with LOVE 11.3 though, so I'm not sure what do you mean by the ban of file://. Do you have more info on this, I'd like to read about the internals a bit more.

@radgeRayden, thanks, good to know! Do you have an example? When I try xdg-open ~/downloads/game.love I get the "no game" screen no matter the version I try. Maybe I need some flags? The --chooser flag gives me the option of love, but not love loader.

@radgeRayden
Copy link

@andreyorst here's my actual script:

#!/usr/bin/fish

set -l DIR (realpath (dirname (status --current-filename)))
echo $DIR
pushd $DIR
rm -rf ./dist
mkdir ./dist
cp -rf main.lua conf.lua settings.lua ./src ./lib ./assets ./dist
set -l NAME (string match -rg ".+/(.+\$)" $DIR)
set -l LOVEFILE "$NAME.love"
pushd ./dist
zip -ru  "$LOVEFILE" .
xdg-open ./$LOVEFILE
popd
popd

But now that you mention it, I think I open with love, not the loader.

@MikuAuahDark
Copy link
Collaborator

MikuAuahDark commented Sep 8, 2024

The file:// bans is documented here https://developer.android.com/about/versions/nougat/android-7.0-changes#permfilesys. For LOVE 11.3, I believe it was stil works (alebit it will prompt you for external storage permission) because it didn't target Android 10 yet. Starting in Android 10 and LOVE 11.4, external storage permission is further restricted to the point it's safe to say it's no longer available (see #194).

@andreyorst
Copy link
Author

@MikuAuahDark thanks for the info!

@radgeRayden thanks! It's weird that for me this approach gives the default "no game" screen. What version of LOVE do you use?

@radgeRayden
Copy link

@MikuAuahDark thanks for the info!

@radgeRayden thanks! It's weird that for me this approach gives the default "no game" screen. What version of LOVE do you use?

11.5.0

@andreyorst
Copy link
Author

OK, thanks. If I'll figure this out, I'll post here what I found.

Was reading #194, and I gotta say, that doing game dev (or any kind of development) on the phone is not as weird or unnatural. Termux can get you pretty far, and modern phones are practically full-blown computers in terms of power. I did a lot of projects over the last 10 years from my phone, and lately, it's becoming harder to do "thanks" to Google, which is a shame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants