Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send coordinates to the device

I'm learning about android and i have a problem.

I have some problems with de emulator so I run my app in a real device. But I have a problem because i have to simulate that I approach to some point. For example, i'm at x-10,y-10 and when I am at x, y I have to show an information.

I know how to send a position by telnet and I know the DDMS tool but, can I use the DDMS tool to simulate this in a real device? How?

I've read that:

With the DDMS tool, you can simulate location data a few different ways:

  • Manually send individual longitude/latitude coordinates to the device.
  • Use a GPX file describing a route for playback to the device.
  • Use a KML file describing individual place marks for sequenced playback to the device.

but I see that de location controls are disabled.

Thanks in adavance

like image 643
Carles Costa Avatar asked Jul 17 '26 18:07

Carles Costa


1 Answers

You can use apps like Fake gps.

https://play.google.com/store/apps/details?id=com.lexa.fakegps&hl=en

Download and install this apk. You can set any location.

To check whether you reached your location say (x, y):

Check the distance between (x, y) and your current gps lcoation. If the distance in meters between these two locations is 0 (In practical give a buffer of atleast 10) then you reached your destiny!

Location currentLocation = your current location fetched from GPS.
Location destinationLocation = your destination location co ordinates

if (currentLocation.distanceTo(destinationLocation) <= 10) {
  // Reached destiny
}
like image 65
3 revsdsc Avatar answered Jul 20 '26 09:07

3 revsdsc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!