Search code examples
google-glassgoogle-mirror-api

How can I delete multiple timelineitem from a single event


I have bundle of timeline item. Now I want to delete two timeline from my bundle.

fact is I can delete timeline through menu click event and only the current timeline has been deleted.

I want to delete the current timeline [such as A] and also another timeline [such as B]. from single menu click from timeline [such as A].

How can I do this?


Solution

  • There are three things you need to do as part of this:

    1. Know when card A was deleted
    2. Know or get the ID of card B
    3. Delete card B based on its ID

    Step 1 is done by subscribing to notifications using subscriptions.insert and handling the DELETE operation. While card A will be deleted for you, you can then use this as a trigger to also delete card B.

    Step 2 can be done a number of ways. If you're storing the ID of card B, you have everything you need. If you didn't store the ID, you'll need to issue a timeline.list command to get the ID you need. One possible way might be to use the ID of card A, do a timeline.get on A to get the bundleID, and then do the timeline.list of the bundleID to get all the other cards in that bundle.

    Once you have the ID (by any of the above methods, or by some other magical means), you can then do Step 3 by issuing the timeline.delete command against the ID of card B to delete it.