How can I start an intent from a card in Google Gl

2019-02-10 12:47发布

问题:

I've tried this app, Crystal Shopper :

https://crystalshopper.herokuapp.com/

which seems to be able to start an application from a card.

As you can see in this screenshot

https://crystalshopper.herokuapp.com/static/images/barcode_search.png

there seems to be a command called

crystalshopper://open

Source seems unavailable, so I must infer...

Is correct to assume that this is simply an action which, through the Mirror API, tells the server to send a special notification to the device, which is detected by a BroadcastListener, which will then launch the required Intent?

回答1:

If an APK installed on Glass registers a custom URI scheme, Mirror API Glassware can launch it by using a menu item with the OPEN_URI action. Set the payload attribute of the menu item to the custom URI and it will launch the appropriate activity when tapped.