In your GoodBarber HTML5 plugin, you can use "basic" methods, allowing interactions with the user's device.

These methods are also available in the Basic Custom sections.

Most of the basic methods can be called by launching a navigation to a standard URL scheme. They're also available, in an easier way, in the GoodBarber JavaScript ToolKit.


1

Web Browser Navigation (http://)

If you want to start a navigation to an external URL - typically a web link-  you can just call the link.

The http:// prefix will be interpreted by the app to be opened in the internal browser.

Example of a link to Google within a plugin:
<a href="http://www.google.com">Go on Google</a>


2

Mail Composer (mailto:)

Il you want to open the phone's Mail app composer, to allow your users to send an e-mail from your plugin, you just have to launch a navigation towards a mailto: scheme.

According to the standard , a mailto: link can handle several parameters (to address, subject, body, etc.).

Example of mailto: link within a plugin:
<a href="mailto:contact@goodbarber.com?subject=Hello&body=GoodBarber">Send an e-mail</a>


3

Call (tel:)

If you want to start a phone call within your plugin, you can use the URL prefix tel:.

Warning: There are no alert before the phone call starts using the tel: method. If you want to ask your user for a confirmation, you'll need to implement a confirmation alert.

Example of phone call within a plugin:
<a href="tel:+1(555)555-5555">Call +1 (555) 555-5555</a>


4

SMS Composer (sms:)

If you want to open the phone's SMS composer within your plugin, you can use the URL prefix sms:.

It is unfornately impossible to set the SMS body, but you can set a default recipient.

Example of SMS within a plugin:
<a href="sms:+1(555)555-5555">Text +1 (555) 555-5555</a>


5

The maps method allows to open directly the Maps native app on the user's device, with one or several parameters.

The parameters to include into the URL are the one which usually follow URLs like "http://maps.google.com" and "http://maps.apple.com". You can find more information about these parameters in the Apple reference documentation .

The maps method allows you to send seamlessly the user to the dedicated native app of his device (Maps on iOS, Google Maps on Android). If you want to send your users to a specific app (without the automatic choice), you can directly make a link to the destination URL that will be opened into the in-app browser. 

Example of the maps method usage:
<a href="goodbarber://maps?q=cupertino">Locate "Cupertino"</a>


6

The openapp method allows you to open a custom URL scheme, if an app able to open it is installed on the user's device, and to open a web URL if not.

URL parameters:
scheme : the custom URL scheme of the app to be opened (has to be url encoded)
url : the URL to open if the device can't handle the URL scheme

Example of the openapp method usage:
<a href="goodbarber://openapp?scheme=twitter%3A%2F%2F&url=http%3A%2F%2Fwww.twitter.com">Open the Twitter app if it's installed, or go to the website otherwise</a>


7

Method : openExternal (Open an URL in the external browser)

The openExternal method allows you to open the phone's browser (and leave the app).

URL parameters:
url : the URL to open

Example of the openexternal method usage: 
<a href="goodbarber://openExternal?url=http%3A%2F%2Fwww.twitter.com">Open this link in the external browser</a>


8

Method : gotosection (Go to a page)

The gotosection method allows you to make a link to another page of your app.

URL parameters:
id : the page identifier

NB : To find your pages ids, go to the Developer section of your GoodBarber backend.

Example of the gotosection method usage:
<a href="goodbarber://#!section=123456789">Open the news section of the app</a>


Outros artigos