I have added a first version of "SDL_OpenURL" function for Android and Unix.
It works with URLs, and probably with directories and files.
It would be nice if someone could add MacOSX, IOS, Windows, etc.
Post by Eric Wing
Sorry, I'm really late on this one too. But I have useful info I hope.
There are official APIs for opening a URL on Mac, iOS, Android, and
Windows. I don't know about Linux except for the command line
[[NSWorkspace sharedWorkspace] openURL:the_url];
[[UIApplication sharedApplication] openURL:the_url];
LONG r = ShellExecute(NULL, "open", "http://www.microsoft.com", NULL,
(maybe that should be ShellExecuteA)
I forgot the details of Android, but you use Intents.
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
Now please don't limit URLs to just http://. It is very common on Mac,
iOS, and Android to use custom URLs to launch specific apps. Sometimes
they are for popular protocols so people spontaneously conform their
apps to URL schemes that get documented so their apps can handle them
too, say like twitter:// (The OS may have an arbitration system if
multiple apps handle the same URL scheme.)
Particularly in mobile games, I've seen a lot of developers
cross-promote their apps, where one app can launch another and maybe
you win points or something for doing so.
The Mac and iOS code will just work for that case. I think Windows may
work too. Android is a little more involved if I remember and you may
have to add more cases, but I've totally forgotten the details of how
Also, there is a counterpart system to this. It is also handy to know
when you've been launched via OpenURL. And you need to be able to
parse the URL string for information that was passed. For example,
most text editors on the Mac respond to URL schemes (even MacVim) and
you can tell it to open a specific file at a specific line number. Or
in the cross-promotional example above, you want to know which app
launched you. The receiving app needs a notification that OpenURL was
invoked with a particular string. Also, keep in mind that the app may
or may not have been already running when this even happened.
Beginning iPhone Games Development
SDL mailing list