Question

Im currently working on an app that will request GPS location updates. I have successfully implemented it as well as the latitude API and OAuth 2.0. It seems like the latitude API only reads the users last google latitude update. I dont know how to insert a new update into the latitude API.

An example would be https://play.google.com/store/apps/details?id=gaugler.backitude&hl=en They are able to insert new gps updates directly to google latitude.

How can I achieve this?

Était-ce utile?

La solution

This can be done with the current location insert() API call:

https://developers.google.com/latitude/v1/currentLocation/insert

Autres conseils

used the oauth playground to Post the following to the api u ask about

IMO at {data, all u really need are latitude, longitude. You will have to check that.

POST /latitude/v1/location HTTP/1.1

Host: www.googleapis.com Content-length: 244 Content-type: application/json Authorization: OAuth ya29.AHES6ZTbG5HRDWduqeV60o_GWYagNg1BEk4c89V5ocSh0W2yc6FRYg {"data":{"kind": "latitude#location", "timestampMs": "1355601946",
"latitude": "22", "longitude": "22", "accuracy": "40", "speed": "10", "heading": "180", "altitude": "42", "altitudeAccuracy": "50", "activityId": "xyzzzzzzz"}}

HTTP/1.1 200 OK Content-length:

158 Via: HTTP/1.1 GWA X-content-type-options: nosniff Etag: "0UQtEv4nUExaO_EaPNLUB8rXY8M/mI3wNTFvwTjtI9TlZ9A9neseLn0" X-google-cache-control: remote-fetch -content-encoding: gzip Server: GSE Reason: OK X-xss-protection: 1; mode=block Pragma: no-cache Cache-control: no-cache, no-store, max-age=0, must-revalidate Date: Sat, 15 Dec 2012 20:32:11 GMT X-frame-options: SAMEORIGIN Content-type: application/json; charset=UTF-8 Expires: Fri, 01 Jan 1990 00:00:00 GMT {"data":{"kind":"latitude#location","timestampMs":"1355601946","latitude":22.0,"longitude":22.0,"accuracy":40,"speed":10,"altitude":42,"altitudeAccuracy":50}}

For dev against these api's you should consider 2 things:

debug on your stack will require that you inspect HTTP HEADERS, HTTP WIRE so, look them up and figure out how to display

use the 'oauth playground' to simulate what your app will POST. Simply put, if it works in the playground combined with CURL client , you will know exactly what to do in your app.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top