+ Start a Discussion
SKolakanSKolakan 

GeoLocation API for Salesforce1 app on iPad

Hi,
I am trying to get device's Lat and Long using HTML5 geo location api in a Visualforce page. The code is pretty simple and reads location on desktop browser, iPhone salesforce1 app, iPhone's safari browser, iPad's safari browser but just does not work on iPad's Salesforce1 app

I tested it with iPad2 with iOS(8.1.2) and iPad air with iOS(8.1.2). it does not work on either of them when I am using Salesforce1 app.

Here is the code
 
<apex:page sidebar="false" showheader="false" standardController="Account"  docType="html-5.0">
      
<script>    
    function initialize() {     
        var lat, lon;          
          
         // Call getCurrentPosition method if geolocation object exists
         if (navigator.geolocation) {                               
             navigator.geolocation.getCurrentPosition(onSuccess,onError,{enableHighAccuracy:false,timeout:5000});                
          } 
   }   
    
    //success callback
    function onSuccess(position){                    
         lat = position.coords.latitude;
         lon = position.coords.longitude; 
         
         alert('lat:' + lat + ' lon: ' + lon); 
    }
    
    //error callback
    function onError(err){
        alert(err.message);
    }
        
</script>
    
    <body style="font-family: Arial; border: 0 none;" onload ="initialize()" >
    
    </body>
</apex:page>

Just to add more info and if it makes sense, here is iPad's safari user agent: 
Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B440 Safari/600.1.4

Here is iPad Salesforce1 app's user agent: 
iPhone OS/8.1.2 (iPad) Salesforce1/7.0.1(3002938) XBranding/1.0 SalesforceTouchContainer/2.0 Mozilla/5.0 (iPad; CPU OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B440 (400081632)

I was wondering if anyone experienced similar behaviour or if any one was able to read device locaiton on iPad using salesforce1 app.
Best Answer chosen by SKolakan
Gaurav KheterpalGaurav Kheterpal
This is a known issue reported here and is currently under 'Review'.

https://success.salesforce.com/issues_view?id=a1p300000008X8YAAU

I hope this helps.

All Answers

Gaurav KheterpalGaurav Kheterpal
This is a known issue reported here and is currently under 'Review'.

https://success.salesforce.com/issues_view?id=a1p300000008X8YAAU

I hope this helps.
This was selected as the best answer
SKolakanSKolakan
Thank you Gaurav.