3

Could you please guide me how doing this. I have to get used location changes and have to send some information depend on that location.

Sanath
  • 493
  • 7
  • 22

2 Answers2

4

See https://developers.google.com/glass/location and https://developers.google.com/glass/v1/reference/locations for complete information about using Locations with Google Glass.

Keep in mind that you need to request the additional scope https://www.googleapis.com/auth/glass.location in order to get any location information.

Once you have done this, Glass will attach the most recently known location (usually where you have been sometime in the past 10 minutes) to any timeline items reported to you.

At any time you can get a list of location updates available, or the "latest" location available from Glass. Additionally, you can subscribe to the "locations" collection (see https://developers.google.com/glass/v1/reference/subscriptions) and you will receive a location change notice roughly every 10 minutes which includes an ID to fetch the associated location.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Hi thank you.I subscribe my location updates inside glassware. – Sanath Oct 04 '13 at 06:54
  • One question: I am currently testing the Glass Mirror API and I want to test subscriptions from a stand alone application and a local servlet, when creating the subscription object all documentation says that the "userToken" is just an opaque token. How do I generate this? What should be the value of this? – Jorge Valois Jan 30 '14 at 20:31
  • @jorge - your question isn't really related to the original question. It is best sled as a new question on Stack Overflow. – Prisoner Jan 30 '14 at 22:08
0

We can insert subscription for location changes when a user subscribes our Glassware application. After that mirror API will notifies location changes to given url.

Like this

            //create a Subscription for location changes
            Subscription subscriptionLocation = new Subscription()
            {
                Collection = "locations",
                UserToken = userId,
                CallbackUrl = Url.Action("Notify", "Notify", null, Request.Url.Scheme)
            };
            //insert a Subscription
            mirrorService.Subscriptions.Insert(subscriptionLocation).Fetch();
Sanath
  • 493
  • 7
  • 22