Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening URLs with the browser - RoboVM/iOS

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.

like image 370
alpine4 Avatar asked Jan 20 '14 19:01

alpine4


1 Answers

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 ;) )

like image 73
Lestat Avatar answered Oct 14 '22 18:10

Lestat