Layar Intent
Three types of intent are defined in Layar.
layar://<layername>
Example: | layar://examplelayer |
Explanation: | This intent should be used for linking to a layer from within the Layar app (actions, redirects, links within the webviews etc... inside a layer). NOTE: that on iphone and android (and only on these platforms), this also works from external applications but only if the Layar Browser is installed. We recommend to use the second form below if you are not sure on which platform the user is or whether the Layar Browser is installed. |
Supported Platform: | All platforms |
Introduced API: | v3.0 |
When to use: |
|
Additionally, extended URL scheme for "layar://" intent is supported. Please see detailed description below:
layar://<layername>/?action=refresh | |
---|---|
Example: | layar://examplelayer/?action=refresh |
Explanation: | When clicked, this link returns the user to the layer in the URL (AR view) and refreshes the POIs (a new GetPOI request is sent). |
Minimum API version: | v3.0 |
layar://<layername>/?<filter>=<value> | |
---|---|
Example: | layar://examplelayer/?CUSTOM_SLIDER_2=540 |
Explanation: | A layer can be opened directly with specific filters set in the parameters of the URL. The available filter settings are RADIOLIST, SEARCHBOX*, CUSTOM_SLIDER*, CHECKBOXLIST, radius. |
Minimum API version: | v3.0 |
layar://<layername>/?action=refresh&<filter>=<value> | |
---|---|
Example: | layar://examplelayer/?action=refresh&CUSTOM_SLIDER_2=540&radius=3500 |
Explanation: | The above params can be combined (concatenated with &). The example intent will get back to the AR view, refretch the POIs with the new setting for the second custom slider and search range. |
Minimum API version: | v3.0 |
layar://<layername>/?action=update | |
---|---|
Example: | layar://examplelayer/?action=update |
Explanation: | When clicked, the client will just consider the getPOI response as an update on the current POIs (a new GetPOI request is sent). |
Minimum API version: | v4.0 |
layar://<layername>/?<custom_param>=<value> | |
---|---|
Example: | layar://examplelayer/?deletedPOIid=3 |
Explanation: | custom parameters can be added in the intent. All non-known(unreserved) parameters will be passed as
is in the getPOI request to the content provider. Reserved parameters are: userId, developerId, countryCode, action, pageKey, oAuth parameters, radius, local CountryCode, requestedPoiId, developerHash, timestamp, version, layerName, requestedPoiId, lang, lat, lon, alt, accuracy, RADIOLIST, SEARCHBOX*, CUSTOM_SLIDER*, CHECKBOXLIST and pageKey. Except for the filter settings parameters, other reserved parameters could not be manipulated. For instance, layar://examplelayer/?lat=xxx&lon=yyy, lat and lon values would not be accepted by the Client NOTE: New reserved parameters added in the future will always have "ly_" prepended to them, in order to avoid conflicts with parameters used in layers. custom parameters therefore should not start with "ly_". |
Minimum API version: | v4.0 |
layar://<layername>/?action=<value>&<custom_param>=<value>&<filter>=<value> | |
---|---|
Example: | layar://examplelayer/?action=refresh&radius=2500&deletedPOIid=3 |
Explanation: | A combination of action, filter settings and custom parameters is also supported. |
Minimum API version: | v4.0 |
http://m.layar.com/open/<layername>
Example: | http://m.layar.com/open/examplelayer |
Explanation: | This version should be used for linking to a layer from external applications. It will open a web page allowing the user to directly open the layer from that page or, if the Layar Browser is not installed, download the app from the stor for that platform. NOTE: on Android, if Layar Browser is installed, user will be able to choose to open the link directly in the app. |
Supported Platform: | All platforms |
Introduced API: | v3.0 |
When to use: |
|
layarshare://<layername>/?<parameters>
Example: | layarshare://examplelayer/?icon=http%3A%2F%2Ffoo%2Fbar.png&title=Treasure%20hunt&type=message |
Explanation: | Layar internal intent which can be used in Layar action to enable sharing a layer or POI to Facebook and Twitter. A developer can add this intent as the URI of an action, in his own buttons in a web view or even as an HTTP redirect. When using a redirect, take care not to surprise the user with a sharing screen but show it in response to an action that would logically trigger sharing. The sharing intent takes several parameters to format the sharing dialog. NOTE: Parameters need to be URL-encoded. The intent parameters are explained below. NOTE: This sharing intent can only be used within the Layar app. |
Supported Platform: | All platforms |
Introduced API: | v5.0 |
When to use: | sharing a layer or a POI to Facebook and Twitter via layer and POI action |
- Sharing a message
Key | Mandatory/ Optional | Value | Example | Description |
---|---|---|---|---|
title | mandatory | string | Treasure hunt | Title to show with the shared message |
type | mandatory | string | message | Determines if the action should trigger sharing a message or a screenshot. use "message" to share a message. |
link | optional | url | http://developer.com/scoreboard/user | This link is attached to the title parameter. It can be linked to a web page which shows more information about shared message. |
icon | optional | url | http://developer.com/image.png | Places this icon next to a status update on Facebook. If not provided, the layer's icon (defined under Listing & indexing tab of the layer editing page) will be used. The recommended icon size is 150x150. Not possible when sharing on Twitter. |
description | optional | string | Find more treasures with this layer! | Text that will show when the user shares their status update. This text is determined by the developer and cannot be changed by the user. |
service | optional | string(facebook, twitter, developer) | Introduced in API v7.0. This specifies a specific service this share action is meant to be used
for. Only 'facebook', 'twitter' or 'developer' are supported at the
moment. 'developer' works only if 'type' is 'screenshot' and is then
pointing to the layer-defined developer URL for sharing screenshots
. If not specified, the user gets to choose which service to use. If specified, the user will directly use the defined service. |
- Share a screenshot
Key | Mandatory/Optional | Value | Example | Description |
---|---|---|---|---|
type | mandatory | string | screenshot | Determines if the action should trigger sharing a message or a screenshot. use "screenshot" to share a screenshot. |
service | optional | string(facebook, twitter, developer) | Introduced in API v7.0. This specifies a specific service this share action is meant to be used
for. Only 'facebook', 'twitter' or 'developer' are supported at the
moment. 'developer' works only if 'type' is 'screenshot' and is then
pointing to the layer-defined developer URL for sharing screenshots
. If not specified, the user gets to choose which service to use. If specified, the user will directly use the defined service. |
When posting a screenshot, the screenshot and a prefilled description by the Layar client will be posted to facebook and twitter.
The example below has two POI level action for sharing and two layer level actions for sharing.
{ "layer": "sharingapi", "hotspots": [ { "id": "GeoPOI_1", "anchor": { "geolocation": { "lat": 52.3729, "lon": 4.9357 } }, "text": { "title": "Geo POI" }, "actions": [ { "label": "Share message", "uri": "layarshare:\/\/sharingapi\/?title=message%20title&type=message&link=http%3A%2F%2Fcustom.layar.nl%2F&icon=http%3A%2F%2Fcustom.layar.nl%2FPOIimage.jpg&description=check%20out%20this%20object", "contentType": "application\/vnd.layar.internal", "activityType": 13 }, { "label": "Share screenshot", "uri": "layarshare:\/\/sharingapi/?type=screenshot", "contentType": "application\/vnd.layar.internal", "activityType": 13 } ] } ], "actions": [ { "label": "Share message", "uri": "layarshare:\/\/sharingapi\/?title=message%20title&type=message&link=http%3A%2F%2Fcustom.layar.nl%2F&description=check%20out%20this%20layer&service=facebook", "contentType": "application\/vnd.layar.internal", "activityType": 13 }, { "label": "Share screenshot", "uri": "layarshare:\/\/sharingapi\/?type=screenshot&service=twitter", "contentType": "application\/vnd.layar.internal", "activityType": 13 } ], "refreshInterval": 10, "fullRefresh": false, "errorCode": 0, "errorString": "OK" }