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 WingSorry, 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
xdg-open.
Mac
[[NSWorkspace sharedWorkspace] openURL:the_url];
iOS
[[UIApplication sharedApplication] openURL:the_url];
LONG r = ShellExecute(NULL, "open", "http://www.microsoft.com", NULL,
NULL, SW_SHOWNORMAL);
(maybe that should be ShellExecuteA)
I forgot the details of Android, but you use Intents.
http://stackoverflow.com/questions/3004515/android-sending-an-intent-to-browser-to-open-specific-url
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
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.)
http://wiki.akosma.com/IPhone_URL_Schemes
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
it works.
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.
Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org