Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Newbie - Howto get the address and phone position by TLocationSensor or ...


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 6 - Last Post: Jun 4, 2015 8:29 AM Last Post By: Michael Eriksen
Michael Eriksen

Posts: 14
Registered: 6/29/15
Newbie - Howto get the address and phone position by TLocationSensor or ...  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2015 6:14 AM
Hey all

I'm a newbie into mobile developing. So thanks in advance for any help :-) I have googlet everything :-(
I hope that you are able to help me.

What I need is just to return the position of the Android phone and the address (maybe via a TCivicAddress variable) in a FormCreate event.
And I have tried so much yet via TLocationSensor with a TCivicAddress variable - but I don't know where to start now.
So I will appreciate if someone has a codesnippet that can help me - or a little guide to "howto do it".

I'm using XE8.

Thanks in advance
Michael Eriksen

Edited by: Michael Eriksen on Jun 3, 2015 11:48 AM

Edited by: Michael Eriksen on Jun 3, 2015 12:31 PM
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Newbie - Howto get the address and phone position by TLocationSensor or ...  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2015 10:45 PM   in response to: Michael Eriksen in response to: Michael Eriksen
Don't use the OnFormCreate event for that. It could make your app appear slow loading. You could use a TTimer and enable it in OnFormCreate maybe instead.

http://www.fmxexpress.com/directly-access-the-gps-location-sensor-with-the-jni-in-delphi-xe7-firemonkey-on-android/
Michael Eriksen

Posts: 14
Registered: 6/29/15
Re: Newbie - Howto get the address and phone position by TLocationSensor or ...  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 2:03 AM   in response to: Eli M in response to: Eli M

2 questions:
1) Is iit possible to use that code on a phone without a gps?
2) where is the uses clause to the code and FLocationManager and TLocationListener?

Edited by: Michael Eriksen on Jun 4, 2015 2:09 AM

Edited by: Michael Eriksen on Jun 4, 2015 2:19 AM
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Newbie - Howto get the address and phone position by TLocationSensor or ... [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 5:00 AM   in response to: Michael Eriksen in response to: Michael Eriksen
Am 03.06.2015 um 21:31 schrieb Michael Eriksen:
Hey all

I'm a newbie into mobile developing. So thanks in advance for any help :-) I have googlet everything :-(
I hope that you are able to help me.

What I need is just to return the position of the Android phone and the address (maybe via a TCivicAddress variable) in a FormCreate event.
And I have tried so much yet via TLocationSensor with a TCivicAddress variable - but I don't know where to start now.
So I will appreciate if someone has a codesnippet that can help me - or a little guide to "howto do it".

I'm using XE8.

Thanks in advance
Michael Eriksen

Edited by: Michael Eriksen on Jun 3, 2015 11:48 AM

Edited by: Michael Eriksen on Jun 3, 2015 12:31 PM

Hello,

if I'm, not mistaken there is a demo project for excactly such a thing
among the Delphi samples installed on your computer. Those are under the
documents folder somewhere.

Greetings

Markus
Michael Eriksen

Posts: 14
Registered: 6/29/15
Re: Newbie - Howto get the address and phone position by TLocationSensor or ... [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 5:17 AM   in response to: Markus Humm in response to: Markus Humm
if I'm, not mistaken there is a demo project for excactly such a thing
among the Delphi samples installed on your computer. Those are under the
documents folder somewhere.

Thank you so much - but I have tried it with no success :-(
It does'nt show up the webbrowser with google maps :-(

Is it because I need a phone with a GPS ?? Or is it possible to read the coordinates on a phone without a GPS?

Thanks in advance for any help :-)
Michael
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Newbie - Howto get the address and phone position by TLocationSensor or ... [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 7:38 AM   in response to: Michael Eriksen in response to: Michael Eriksen
Am 04.06.2015 um 14:17 schrieb Michael Eriksen:
if I'm, not mistaken there is a demo project for excactly such a thing
among the Delphi samples installed on your computer. Those are under the
documents folder somewhere.

Thank you so much - but I have tried it with no success :-(
It does'nt show up the webbrowser with google maps :-(

Is it because I need a phone with a GPS ?? Or is it possible to read the coordinates on a phone without a GPS?

Thanks in advance for any help :-)
Michael

Hello,

I don't exactly know what you're doing but:

1. you should be able to find a specification list of your smartphone
on the internet and this should tell you if it has GPS or not.

2. you can afaik get a position without GPS if you have internet access
(not sure if it's bound to WiFi), but that is not as precise and may
depend on the area where you are etc.

3. What did you do to show Google Maps? Did you embedd a TWebbrowser
and call maps with some proper URL?
Does that one work if you open maps on your desktop, go to your
current location and use the URL for that on TWebbrowser?

Greetings

Markus
Michael Eriksen

Posts: 14
Registered: 6/29/15
Re: Newbie - Howto get the address and phone position by TLocationSensor or ... [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 8:29 AM   in response to: Markus Humm in response to: Markus Humm
Hello,

I don't exactly know what you're doing but:

1. you should be able to find a specification list of your smartphone
on the internet and this should tell you if it has GPS or not.

2. you can afaik get a position without GPS if you have internet access
(not sure if it's bound to WiFi), but that is not as precise and may
depend on the area where you are etc.

3. What did you do to show Google Maps? Did you embedd a TWebbrowser
and call maps with some proper URL?
Does that one work if you open maps on your desktop, go to your
current location and use the URL for that on TWebbrowser?

Greetings

Markus

Thanks for the reply.
I will figure it out.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02