Google Glass: Performing “Click” event or somethin

2020-07-24 04:10发布

问题:

Please have a look at the following code

<article style="left: 640px; visibility: visible;">
 <section>
   <table>
    <tbody><tr><td><center>154 de 500</center></td></tr>
    <tr><td>First Page</td></tr>
   </tbody></table>
 </section>
</article>

This generates the following UI

When I select the "First Page" text, I need that text to change into "You Clicked This". How can I do this? Is there any event handler for click or any other way to do this? I am sorry if this is a simple question, this is the first time I managed to write something that really worked on PlayGround.

I know it is not like PC so you are 100% free to suggest me how to select the text. May with Voice commands, maybe with clicks or whatever, but user need to select it somehow so that text will change.

回答1:

Users can't click on the contents of timeline cards. You have to add menu items which will appear when the user taps while looking at your card. When the user selects a menu item, Google will then notify your server (see 'subscriptions' in the docs) and your server can then send a PUT request back to Google to replace the original item.

The glass dev site has a bunch of info on menus and subscriptions. The playground tool is of limited use with these things though so you'll need to work with real Glass hardware. You also need to have your subscription callback running on a server that the Google can reach.. So, not localhost on your dev PC unless you have some kind of proxy setup (I use runscope for that)