Jump to content


Photo

I want to retrieve latitude and longitude from geolocation from smartphone


  • Please log in to reply
7 replies to this topic

#1 logisticasoft

logisticasoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 197 posts

Posted 24 April 2016 - 01:21 PM

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 

 


  • 0

Carlos Ramirez

ramirez.carlos@yahoo.com


#2 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 347 posts

Posted 24 April 2016 - 04:58 PM

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()

Attached Files


  • 0

#3 logisticasoft

logisticasoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 197 posts

Posted 25 April 2016 - 01:18 AM

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


  • 0

Carlos Ramirez

ramirez.carlos@yahoo.com


#4 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 347 posts

Posted 25 April 2016 - 10:40 AM

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;

  • 0

#5 logisticasoft

logisticasoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 197 posts

Posted 25 April 2016 - 08:28 PM

Hi Lemma thank you very much


  • 0

Carlos Ramirez

ramirez.carlos@yahoo.com


#6 Schuiab

Schuiab

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 315 posts

Posted 07 November 2016 - 04:09 PM

 

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


  • 0

#7 mjcramos

mjcramos

    Member

  • uniGUI Subscriber
  • PipPip
  • 34 posts

Posted 28 June 2017 - 03:31 AM

Hello, I was trying to do this implementation here but with the mobile device it is not going at all, why when I test on the computer it works normal, and when it goes to the cell phone, it does not work?


  • 1

#8 Stas

Stas

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 173 posts
  • LocationKiev Ukraine

Posted 28 June 2017 - 04:07 AM

You must use https


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users