I have a card that is being inserted in my timeline by the mirror api.
The card has 3 options: SCAN, REPLY, DELETE.
Expected-> Barcode Test[SCAN, REPLY, DEL
The OPEN_URI
menu item requires that you specify a valid URI for the payload.
To use the web browser to open a page, this will look just like what you'd put into a normal desktop web browser so your insertion would look something like that:
.mirror.timeline.insert(
{
"text": "Barcode Test",
"callbackUrl": "https://mirrornotifications.appspot.com/forward?url=http://localhost:8081/reply",
"menuItems": [
{
"action": "OPEN_URI",
"id": "complete",
"payload": "http://example.com",
"values": [{
"displayName": "Scan",
"iconUrl":"http://example.com/icon.png"
}]
},
{"action": "REPLY"},
{"action": "DELETE"}
]
} )
You can also use OPEN_URI
to initiate an activity on an android app using a custom protocol.
I don't know much about the implementation of the scanner you are trying to use, but here's how you'd wire it up for your own GDK app.
You need to specify the custom protocol in your AndroidManifest.xml
by adding something like this:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="exampleprotocol" />
</intent-filter>
You must specify a URI with that protocol in your Mirror API timeline item. Your insert code might look something like this:
.mirror.timeline.insert(
{
"text": "Barcode Test",
"callbackUrl": "https://mirrornotifications.appspot.com/forward?url=http://localhost:8081/reply",
"menuItems": [
{
"action": "OPEN_URI",
"id": "complete",
"payload": "exampleprotocol://scan",
"values": [{
"displayName": "Scan",
"iconUrl":"http://example.com/scan.png"
}]
},
{"action": "REPLY"},
{"action": "DELETE"}
]
}
)