I have an SDL 2.0 application that will load a file provided by another application (like Dropbox for instance) thanks to “Open with” dialog.
But I don’t know how retrieve the argument given to my app from the other application. On iOS, for the exact same problem, I had to use SDL_DROPFILE event, but it doesn’t seem to work the same way for Android.
I looked at SDLActivity.java to find some clue, but I didn’t find anything.
you have to use Android Intents for this. In the Android port of the
L?VE engine we can open games by opening a link or a file on the phone.
In the AndroidManifest.xml you have to define intent-filters for your
activity that take into account the file scheme, mime type etc. It can
be a bit tricky to get those right and I am still not yet happy how we
do it.
Good luck!
MartinOn 22.10.2014 10:31, Noxalus wrote:
Hello everyone!
I have an SDL 2.0 application that will load a file provided by another
application (like Dropbox for instance) thanks to “Open with” dialog.
But I don’t know how retrieve the argument given to my app from the
other application. On iOS, for the exact same problem, I had to use
SDL_DROPFILE event, but it doesn’t seem to work the same way for Android.
I looked at SDLActivity.java to find some clue, but I didn’t find anything.
I can do like you, but the best way would be to let SDL manage this instead.
For iOS, if we look at the file SDL_uikitappdelegate.m, we can see (line 275) that it uses SDL_SendDropFile function to trigger an SDL_DropEvent with the filename. It should be possible to do the exact same thing updating SDLActivity.java, isn’t it ?