Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get a notification from Glass that a custom menu item was selected?
    primarykey
    data
    text
    <p>I have created a timeline card with a custom menu item. I would like to get a callback when the user has selected that menu item. </p> <pre><code>// Create a menu item for the card var mnuActivate = new MenuItem() { Action = "CUSTOM", RemoveWhenSelected = new bool?(true), Id = ACCEPT_ID, Values = new List&lt;MenuValue>() { new MenuValue() { State="DEFAULT", DisplayName="Activate", }, new MenuValue() { State="PENDING", DisplayName="Activating..." }, new MenuValue() { State="CONFIRMED", DisplayName="Activated" } } } // Create a new card for the user's timeline var item = new TimelineItem() { Html = html, Notification = new NotificationConfig() { Level = "DEFAULT" }, MenuItems = new List&lt;MenuItem>() { mnuActivate } }; var card = this._service.Timeline.Insert(item).Fetch(); </code></pre> <p>I then subscribe to all timeline events and provide an https callback URL<pre><code> // Create a new subscription var subscription = new Subscription() { Collection = "timeline", Operation = new List(), CallbackUrl = "<a href="https://mypubliclyavailableserver.com/notify" rel="nofollow">https://mypubliclyavailableserver.com/notify</a>" }; this._service.Subscriptions.Insert(subscription).Fetch(); // Retrieve a list of subscriptions to make sure it is there. var mySubcriptions = this._service.Subscriptions.List().Fetch(); if (mySubcriptions != null &amp;&amp; mySubcriptions.Items != null &amp;&amp; mySubcriptions.Items.Count == 1) { Console.WriteLine("Subscription created successfully."); }</code></pre> So the subscription is created without any issues as far as I can tell. But after interacting with the card, I never get a callback. What am I missing?</p> <p>Things I have tried:</p> <ol> <li>Populating Ids on the subscription obj, timeline card, and menuItem</li> <li>Subscribing before creating the card instead of after</li> <li>Adding the userId as the UserToken on the subscription object</li> <li>Calling my callback URL directly to ensure that it is listening</li> </ol> <p>JSON Response from GET /mirror/v1/subscriptions:</p> <pre><code>{ "kind": "mirror#subscriptionsList", "items": [ { "kind": "mirror#subscription", "id": "timeline", "updated": "2013-10-28T15:19:19.404Z", "collection": "timeline", "callbackUrl": "https://mypubliclyavailableserver.com/notify" } ] } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload