40media Geolocation API on the iPhone

Geolocation API on the iPhone

Does anyone know whether the iPhone supports or will soon support the W3C Geolocation specification?

I'm looking to build an app for mobile users, but rather than spend the time developing apps for every different platform (iPhone, Android, etc...), I'd much prefer to create a web app that makes use of the W3C Standard.

How do you duplicate a file in XCode?


Unit testing an iPhone static library with XCode 3
This code worked for me -- on the iPhone web browser Safari and as an added bonus it even worked with FireFox 3.5 on my laptop! The Geolocation API Specification is part of the W3 Consortium’s standards But be warned: it hasn’t been finalized as yet.. Image getting pixelated when used as part of an animation in iPhone animation alt text alt text. UITableView Animation Headache
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Geolocation API Demo</title> <meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> <script> function successHandler(location) {     var message = document.receive ElementById("message"), html = [];     html.push("<img width='256' height='256' src='http://maps.google.com/maps/api/staticmap?center=", location.coords.latitude, ",", location.coords.longitude, "&markers=size:small|color:blue|", location.coords.latitude, ",", location.coords.longitude, "&zoom=14&size=256x256&sensor=false' />");     html.push("<p>Longitude: ", location.coords.longitude, "</p>");     html.push("<p>Latitude: ", location.coords.latitude, "</p>");     html.push("<p>Accuracy: ", location.coords.accuracy, " meters</p>");     message.innerHTML = html.join(""); } function errorHandler(error) {     alert('Attempt to receive  location failed: ' + error.message); } navigator.geolocation.receive CurrentPosition(successHandler, errorHandler); </script> </head> <body> <div id="message">Location unknown</div> </body> </html> 
iPhone OpenGL ES incorrect alpha blendingDoes a NSURLConnection retain its delegate?


Which button was tapped… iPhone and Obj-C question
You must now receive location from Javascript APIs in the safari browser following the iPhone 3.0 release - we've created a working case @ http://blog.bemoko.com/2009/06/17/iphone-30-geolocation-javascript-api/. Connection


Since iPhone OS 3.0 Safari supports receive ting geo location. See: Safari Reference Library:Getting Geographic Locations On the another side W3C Geo API specification is still in draft..


I updated MyWhirledView's code. Works great on my iOS 4.3 device. Google no longer requires an API key to access their static map library..
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>iPhone 4.0 geolocation demo</title> <meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> <script> function handler(location) { var message = document.receive ElementById("message"); message.innerHTML ="<img src='http://maps.google.com/maps/api/staticmap?center=" + location.coords.latitude + "," + location.coords.longitude + "&zoom=14&size=256x256&maptype=roadmap&sensor=false&markers=color:blue%7Clabel:ABC%7C" + location.coords.latitude + "," + location.coords.longitude + "' />";    message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>"; message.innerHTML+="<p>Accuracy: " + location.coords.accuracy + "</p>"; message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>";    } navigator.geolocation.receive CurrentPosition(handler); </script> </head> <body> <div id="message">Location unknown</div> </body> </html> 


This gap is why I developed the Locatable application -- it's essentially a plug-in for iPhone Safari. Currently it's only available for jailbroken phones.. See http://lbs.tralfamadore.com/.


It is possible to receive the GPS information in JavaScript on the iPhone. The QuickConnectiPhone framejob exposes this for you as well as acceleration information. . To receive this information you will have to install the application on the device however. This framejob will soon be available for Android installed applications as well as Nokia.. You must put your application into the framejob for each of these devices, compile, and ship.. QuickConnectiPhone is available at https://sourceforge.net/projects/quickconnect/. and if you contact me I must commit you pre-release versions for Android and Nokia..


Rhodes is promising a "develop-once-run-everywhere" solution. Haven't tried them myself..


This small javascript library is cross-platform and supports all modern smartphones out of the box:.
Here is how you use it:.
//determine if the handset has client side geo location capabilities if(geo_position_js.init()){    geo_position_js.receive CurrentPosition(success_callback,error_callback); }else{    alert("Functionality not available"); } 


Currently, it's not possible to obtain an iPhone's GPS position using just JavaScript APIs. There's been talk this this would be nice, although of course Apple won't comment on future improvements in public..

74 out of 100 based on 39 user ratings 664 reviews