ruffle-rs / ruffle-android

An Android application for ruffle.rs
Other
286 stars 39 forks source link

Open game using Intent API or am command #69

Open leonstyhre opened 9 months ago

leonstyhre commented 9 months ago

Hi!

Is there a way to launch a game from an Intent API call or via the am command? I looked at the AndroidManifest.xml file and tried some different things but I couldn't get it to work. Thanks!

torokati44 commented 9 months ago

Hi!

Well, admittedly, I'm not that well versed in these Android-specific things, so I'm not sure... But the <intent-filter> is supposed to register the VIEW intent to be handled by this app, no? That is what makes is possible to simply open an .swf file from, say, the Files (by Google) app, and have Ruffle show up in as a choice for what to open the file with...

So, if you can, when dispatching the intent, perhaps specify a preference towards the app ID as handler, maybe that could work...?

leonstyhre commented 9 months ago

Thanks for the really quick reply! I managed to get it to work using an explicit Intent and the android.intent.action.VIEW action in combination with the FileProvider API.

FYI I'm developing an Android emulator frontend (https://es-de.org/) so very nice to have this integrated :)

By the way, is there any plans to add a way of exiting the game? This would be nice as it would return the user directly to the frontend after he's done playing a game.

torokati44 commented 9 months ago

By the way, is there any plans to add a way of exiting the game?

Doesn't the "<-" button in the top left do just that? :thinking:

leonstyhre commented 9 months ago

The arrow icon goes back to the Ruffle start/game select screen, normally when you run games from a frontend you want to be able to exit the emulator completely and go back directly to the frontend and select the next game from there. Maybe there could be a possibility to add an "X" or similar as well to close Ruffle completely directly when playing a game?