Way to embed a link into an app (esp. phones)

Monkey Forums/Monkey Programming/Way to embed a link into an app (esp. phones)

matty(Posted 2011) [#1]
Hello,

Is there a way to embed a link or allow the user to go to a web page from a screen in a monkey app - especially from a phone or other device. I'm thinking of something along the lines of "visit our website at ...." for example...

I'd guess that it is possible but am not sure how to do it yet...


xzess(Posted 2011) [#2]
Well if you want it portable for different targets you will have to write a browser or HTML parser and write a httpget function. Xaron wrote something like that for monkey called mnet and I did a httpget for iOS in imonk. I dunno really if there are other solutions for other targets released or I don't remember a name to say.
If you want to use the device browser you have to wrap it. You can get this for iOS with imonk's HTMLGet($url) to receive Html string for your own browser or you can use imonks UIBrowser($URL) to open a link in Safari.

You can get them from the modules registry

Hope it helps

greetz


Beaker(Posted 2011) [#3]
If you want to launch the default browser on iOS, you can do something like this:
NSURL *url = [NSURL URLWithString:@..."];
[[UIApplication sharedApplication] openURL:url];


It will need wrapping in a monkey friendly function. You can also open other apps in the same way (eg. SMS, email etc).

Mail:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@\"mailto://support@..."]];


SMS:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];


NB. Remove the slash(\) after the @ symbols.


matty(Posted 2011) [#4]
Thanks - what about on Android?