After a timeline card is updated by the Glassware, is it possible to have only the updated timeline card visible on Glass. Currently, I can see the old timeline card as well as updated timeline card on Glass, but obviously w/ differnt timestamp.
Here's more explanation w/ code:- There are two java classes, NewUserBootstrapper and NotifyServlet. The NewUserBootstrapper takes care of bootstrapping that includes authentication, inserting contact and inserting subscription. This is the code for inserting a timeline item as part of bootstrapping.
// Send a timeline item
TimelineItem timelineItem = new TimelineItem();
timelineItem.setText("Hello");
timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));
TimelineItem insertedItem = MirrorClient.insertTimelineItem(credential, timelineItem);
Now in the NotifyServlet, after the Service is notified of changes to the timeline as part of "take a note" voice command, the NotifyServlet tries to update the text of the same timeline item.
if (notification.getCollection().equals("timeline")) {
// Get the impacted timeline item
TimelineItem timelineItem =
mirrorClient.timeline().get(notification.getItemId()).execute();
//Take a note
if (notification.getUserActions().contains(new UserAction().setType("LAUNCH")))
{
final TimelineItem noteItem = mirrorClient.timeline()
.get(notification.getItemId()).execute();
final String spokenText = noteItem.getText();
if ( spokenText.toUpperCase().contains("DONE")
|| spokenText.toUpperCase().contains("LIST"))
{
noteItem.setText("Hello Glassware");
MirrorClient.
getMirror(credential).timeline().update(notification.getItemId(),
noteItem).execute();
}
}
}
The update of the timeline card does happen, however I can see both the cards, one w/ "Hello" text and the other w/ "Hello Glassware" text but w/ different timestamp. I was expecting to see only the updated timeline card.