Please NOTE that this documentation will not be updated anymore. Please see our new Developer Documentation Site for the latest updates! The content of this page can be found here.
|
Since Layar getPOIs API v5.0, it is possible to pop up a notification as a result of a getPOI response using the new showDialog parameter. The showDialog parameter is similar to the showMessage parameter, but displays a full dialog screen rather than just a message. The dialog has a title, descriptive message and an optional icon (great for badges). At the bottom of the dialog box are customizable buttons that link to developer-specified actions. Example actions to put in here are collecting user input (such as choosing red or blue) or activating the sharing functionality.
Main JSON response:
| Key |
Mandatory/Optional |
Value |
Example |
Explanation |
| showDialog |
Optional |
showDialog object |
See below |
Pop up a configurable dialog with a descriptive text and optionally buttons linking to actions |
The showDialog object looks like this:
| Key |
Mandatory/
Optional
|
Value |
Example |
Description |
title
|
mandatory |
string |
Congratulations! |
Title of the dialog box |
description
|
mandatory |
string |
You just found the hidden treasure! |
Text of the dialog box |
iconURL
|
optional |
url |
http://developer.com/mybadge.png |
Icon to show in the dialog box |
actions
|
optional |
array of action objects |
one action that uses the share intent, e.g.: [{contentType:"application/vnd.layar.internal", uri:"layarshare://mylayer/?type=message&title=Hello&defaultText=My%20first%20share", label:"Share this!", activityType:14}]
|
Buttons to show.
On Android, the physical "back" button will dismiss the dialog. There is a small cross icon on the top right corner of the dialog which can be used to close it on iPhone.
|
NOTE: The showDialog parameter does not necessarily need to be used for sharing, it can contain any action(s), such as loading audio/video, opening a web view or triggering a layer update/refresh.
Example of showDialog usage:
"showDialog": {
"title":"Some title",
"description": "Some description",
"actions": [
{
"contentType" : "application\/vnd.layar.internal",
"uri": "layarshare:\/\/layername\/?type=message&title=test+Title&description=test+Description&defaultText=test+Default+text",
"label": "Share"
},
{
"contentType": "application\/vnd.layar.internal",
"uri": "layar:\/\/layername\/?action=refresh",
"label": "Refresh POIs"
},
{
"contentType" : "text/html",
"method" : "GET",
"activityType" : 1,
"uri": "http:\/\/maps.google.com\/",
"label": "Open google maps"
}
]
}
Trigger share functionality using showDialog as a result of a redirect:
One of the use cases of showDialog can be described like this:
1. User opens a layer, client sends a getPOI request
2. On one of the POIs, there is an auto-trigger so that when the user gets within 5m of it, an async action (for instance, the action is to collect coins) is triggered.
3. The user walks toward the POI, at 5m the action is triggered.
4. A activityMessage is displayed on the screen which says "collecting coin...".
5. The developer returns a response with a layar:// intent so that a new getPOI request is forced.
6. The client refreshes the layer (getPOI request).
7. In the new response, there is a showDialog parameter with the message "Congrats. Coin is collected.". Dialog has a share action: layarshare:// intent.
8. This showDialog parameter is displayed as a pop up with the message and the share action.
The following sequence diagram illustrates what happens when an async action is triggered.

Take the following action as an example:
{
"contentType": "application\/vnd.layar.async",
"method": "GET",
"label": "Collect Coin",
"activityType": 3,
"uri": "http:\/\/custom.layar.nl\/async_call.php",
"showActivity": true,
"activityMessage": "collecting coin..."
}
Comments (0)
You don't have permission to comment on this page.