Reputation: 493
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.
Upvotes: 3
Views: 300
Reputation: 493
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();
Upvotes: 0
Reputation: 50701
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.
Upvotes: 4