Jump to content

I want to retrieve latitude and longitude from geolocation from smartphone


asapltda

Recommended Posts

I want to retrieve latitude and longitude from geolocation !

Hello experts,

I want to know, how would I retrieve Latitude and Longitude from geolocation.

I want to send that via JSON param to my server for storing in my SQL database.

Is it possible to get it as string? using unigui movile 

 

Link to comment
Share on other sites

I want to retrieve latitude and longitude from geolocation !

Hello experts,

I want to know, how would I retrieve Latitude and Longitude from geolocation.

I want to send that via JSON param to my server for storing in my SQL database.

Is it possible to get it as string? using unigui movile 

 

 

Hello,

I am getting lat & lng with a simple geolocation.getCurrentPosition()

mgeolocation.zip

Link to comment
Share on other sites

Thank you for the example sent Mr Lema.

The example works in Windows 10 without any action .

When I test the example in the mobile phone ( huawei Androit 4.2 ) it does not work me .
Could you continue giving me some help

 

I think this example is very valuable for those who started in this topic .

Thanks again from Cali Colombia

Link to comment
Share on other sites

Does your device share its location ?

Can you check it with another browser ?

 

I tested successfuly on iphone and Samsung mobile with Android 4.1.2

 

 

Also change the UnimButton1Click :

procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  UniSession.AddJS(
    'if (navigator.geolocation) { ' +
    '  navigator.geolocation.getCurrentPosition( function(position) { ' +
    '    ajaxRequest(MainmForm.UnimButton1, "CurrentPosition" ,' +
    '      ["lat=" + position.coords.latitude, ' +
    '       "lng=" + position.coords.longitude, ' +
    '       "acc=" + position.coords.accuracy, ' +
    '       "alt=" + position.coords.altitude, ' +
    '       "altacc=" + position.coords.altitudeAccuracy, ' +
    '       "head=" + position.coords.heading, ' +
    '       "ts=" + position.coords.timestamp ' +
    '      ]);' +
    '    })' +
    '} else {alert("Geolocation is not supported.");}');
end;
Link to comment
Share on other sites

  • 6 months later...

 

Does your device share its location ?

Can you check it with another browser ?

 

I tested successfuly on iphone and Samsung mobile with Android 4.1.2

 

 

Also change the UnimButton1Click :

procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  UniSession.AddJS(
    'if (navigator.geolocation) { ' +
    '  navigator.geolocation.getCurrentPosition( function(position) { ' +
    '    ajaxRequest(MainmForm.UnimButton1, "CurrentPosition" ,' +
    '      ["lat=" + position.coords.latitude, ' +
    '       "lng=" + position.coords.longitude, ' +
    '       "acc=" + position.coords.accuracy, ' +
    '       "alt=" + position.coords.altitude, ' +
    '       "altacc=" + position.coords.altitudeAccuracy, ' +
    '       "head=" + position.coords.heading, ' +
    '       "ts=" + position.coords.timestamp ' +
    '      ]);' +
    '    })' +
    '} else {alert("Geolocation is not supported.");}');
end;

Hi Lema,

 

ios having problems and chrome on android, used to work before

 

got it working on firefox on android, but not chrome or on iphone 6s

 

or is it just me

 

many thanks Lema

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...
  • 10 months later...

Hi, thank you for you answer. But could you be a little more explicit and put the correct code? Again, thank you very much

 

Hola Carlos, soy Diego Sandoval, lo que tienes que hacer por disposición de Google Maps es que para usar "geolocation functions" debes usar la app de Unigui en https, en http solamente no te va a funcionar en móviles, es decir, a la app debes adicionarle los certificados ssl necesarios y acceder a ella así: https://app.gollatino.com:8077. Esta es una demo que hice hoy para darte un ejemplo, pruébala en tu teléfono móvil con tu android 4.2 y me avisas cómo te fué

Link to comment
Share on other sites

Hi, when you publish your App at Play store or App store (hybrid app) it is not easy to get work from first, I am fighting for a week for getting location work correctly and also we enable the navigation using Waze or Google maps, I will publish the needed code for Android and swift as soon as I can.

  • Upvote 1
Link to comment
Share on other sites

×
×
  • Create New...