Android Question Location and distance from other devices on googlemaps

henry montoya

Member
Licensed User
Longtime User
Hello everyone.

First of all thank you for this wonderful space and all his great contributions.

I'm working with GoogleMaps, osmdroid, and gps libraries and want to do some things that until now have not found as they are made.

1 - locate, latitude and longitude of other devices with my application installed inside a given radius

2 - Know how long in minutes is there between my current location and another location.

3 - Trace a route between my current location and destination location.

I hope you can help me, thank you for all your contributions.
 

eurojam

Well-Known Member
Licensed User
Longtime User
Do you have already an idea how the locations between the devices will be shared - server or sms or whatever? the rest is more or less easy to do with a route service like google or mapquest.
 
Upvote 0

henry montoya

Member
Licensed User
Longtime User
Hello Eurojam thanks for answering.

I really do not know much about it, I only know locating my current position, and display it on googlemap with the library.
I appreciate if you can guide me about it.
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
first you should make some consideration about "how" the devices with your app are communicating together. Android devices don't "transmit" any GPS signal, they are simply receivers. If you have the possibilty to use a server then your app can send an POST request to the server whenever the position is changed. Also will your app get all locations of devices around via a GET Request - this can be done with httputils2 on the device side. But you will need some knowledge about webservices...some things you have to learn are:
regards
stefan
 
Upvote 0

henry montoya

Member
Licensed User
Longtime User
Of course you're absolutely right, I was thinking about the device as a gps signal transmitter, but now with your answer I have complete clarity that must I do.

Infinite thanks for your reply and helpful links.

With regard to questions 2 and 3

2 - Know how long in minutes is there between my current location and another location.

3 - Trace a route in googlemaps between my current location and destination location.

Do you have any idea ?

Thank you.
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
for 2 :
B4X:
sUrl = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=<START_LOCATION>&destinations=<END_LOCATION>&mode=driving&language=fr&sensor=false&units=metric"

Then a little parsing of the request.
 
Upvote 0

henry montoya

Member
Licensed User
Longtime User
Thanks Imbault
That means that there is no native function google maps, is me who define the speed and then i calculate the time with the distance between points?
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
The API of imbault is very useful.
I tested it and it returned json with all the information you asked for including distance and time, and as he said you now need to parse the text as you wish.
 
Last edited:
Upvote 0
Top