Associate .love files with the app

Create issue
Issue #42 resolved
Martin Felis repo owner created an issue

It would be great if files that are downloaded or attached to emails ending with .love could be associated with the app. Maybe even associating main.lua with the app would be useful.

So far my tinkering was not successful. Any hints appreciated!

Comments (11)

  1. Martin Felis reporter

    @tangzero would be great if you could have a look at it.

    They have two activities: the actual game activity and some kind of launcher in there. In theory using their

                <intent-filter>
                    <action android:name="android.intent.action.VIEW"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                    <category android:name="android.intent.category.BROWSABLE"/>
                    <data android:scheme="file" />
                    <data android:mimeType="*/*" />
                    <data android:pathPattern=".*\\.love" />
                    <data android:host="*" />
                </intent-filter>
    

    together with a new activity (e.g. RunGameActivity) should be enough to associate the files. One would still have to somehow process the intent in the activity. However the file associations did not work for me when clicking on .love files in "Downloads", but maybe I did something wrong.

    If you manage to create such an activity that has access to or receives a path to a .love file I think I can do the rest.

  2. Jairo Luiz

    I can create a function to you (doing my Java/JNI magic).

    Something like "const char * love::android::getSelectedGameFile();"

    So, you can code in the FileSystem.cpp how to load that file.

  3. Martin Felis reporter

    Just an activity that has somewhere access to the file path would be sufficient. I would then hack stuff such that the main() function in love.cpp gets called with that path.

    As a side note: I think we need to reintroduce the love.android module that we can use for initialization stuff.

  4. Martin Felis reporter

    Opening files that were downloaded via email attachements work for me. Also opening files that were downloaded using a download manager (but not the standard download via Chrome) worked when opening with a file explorer.

    Here https://bitbucket.org/MartinFelis/love-android-sdl2/commits/branch/http_downloader is a raough attempt to download the game via http based on the second method described at http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog

  5. Log in to comment