Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <p id="classSummary"> | |
| 2 Use the <code>chrome.location</code> API to retrieve geographical location of | |
|
Jeffrey Yasskin
2013/07/23 20:37:29
I suspect this paragraph belongs in the "descripti
not at google - send to devlin
2013/07/23 20:41:04
There is a README in chrome/common/extensions/docs
vadimt
2013/07/24 19:36:45
Running preview.py results in:
D:\src\Chromium1\sr
| |
| 3 the hosting machine.</p> | |
| 4 | |
| 5 <h2 id="manifest">Manifest</h2> | |
|
Jeffrey Yasskin
2013/07/23 20:37:29
Since there's nothing for someone to do in the man
not at google - send to devlin
2013/07/23 20:41:04
We are supposed to be automatically generating the
vadimt
2013/07/24 19:36:45
Done.
| |
| 6 <p>You must declare the "location" permission | |
| 7 in the <a href="manifest.html">extension manifest</a> | |
| 8 to use the location API. | |
| 9 For example: | |
| 10 </p> | |
| 11 <pre>{ | |
| 12 "name": "My extension", | |
| 13 ... | |
| 14 <b>"permissions": [ | |
| 15 "location" | |
| 16 ]</b>, | |
| 17 ... | |
| 18 }</pre> | |
| 19 | |
| 20 <h2 id="description">Objects and properties</h2> | |
| 21 <p> | |
| 22 To create a location watch, call $ref:chrome.location.watchLocation passing in | |
| 23 the location watch details via the <code>requestInfo</code> parameter: | |
| 24 </p> | |
| 25 <pre>chrome.location.watchLocation(name, requestInfo);</pre> | |
| 26 <p> | |
| 27 You'll also need to add a listener | |
| 28 to its <code>onChanged</code> event. | |
| 29 Chrome will fire this event after you create your location watch. After this, | |
| 30 it will keep firing the event every time the geographical location of your | |
| 31 computer changes until you call $ref:chrome.location.clearWatch. | |
| 32 </p> | |
| 33 <p> | |
| 34 Here's sample code | |
| 35 to listen for location updates: | |
| 36 </p> | |
| 37 <pre> | |
| 38 chrome.location.onLocationUpdate.addListener(function(position) { | |
| 39 console.log(JSON.stringify(position)); | |
| 40 }); | |
| 41 </pre> | |
| OLD | NEW |