I have an android game that uses LibGDX. In it, I have some buttons for opening URLs in the browser via:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://myURL/"));
startActivity(intent);
And that seems to work fine...
The problem is that I'm trying to port the game to run on iOS with RoboVM and can't figure out how to setup something similar.
With the RoboVM bindings, I assumed I'd probably want to be using the openURL() method:
openURL (UIApplication application, NSURL url, String sourceApplication, NSObject annotation)
But besides the NSURL, I don't know what I need to be passing for other 3 parameters. And couldn't find any examples online on how to use it.
There is already an abstraction in libgdx that works on all current supported platforms (Android, Desktop, HTML5, and iOS aswell).
Net#openURI
Gdx.net.openURI("http://stackoverflow.com/questions/21242116/opening-urls-with-the-browser-robovm-ios");
(This is the implementation of RoboVM: RoboVM IOSNet#openURI just as a reference, use the abstraction. No need to make platform specific code when libgdx already did it for you ;) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With