Application to give indications by gps in android? [closed]

0

I was thinking about developing an android application for bus / bus users to find the stops. The idea would be to have my coordinates the coordinates of the stop and see the distance, but I also need indications eg 30 meters forward 20 to the right or simply open google maps and show a line from the point where I am to stop by way faster, does anyone know if android allows you to do this? if so how?

    
asked by anonymous 18.10.2015 / 19:55

1 answer

0

If I'm not mistaken, Google Maps API allows you to start a Intent that provides this navigation between the current location and a defined point, as if it were a GPS navigator.

I can not tell if he calculates the shortest distance because the documentation provides little information about it.

It's pretty simple at first, just create Intent and start:

Uri gmmIntentUri = Uri.parse("google.navigation:q=Taronga+Zoo,+Sydney+Australia");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);

mapIntent.setPackage("com.google.android.apps.maps");

startActivity(mapIntent);

The documentation makes it clear that the q parameter accepts addresses or a geographic position:

google.navigation:q=a+street+address
google.navigation:q=latitude,longitude

Of course you will create a dependency on Google Maps, which may not be available on the device (you will know why ...)

But it's good to do the following check before starting to not cause the app to crash:

if (mapIntent.resolveActivity(getPackageManager() != null) {
    startActivity(mapIntent);
} else {
    Toast.makeText(this, "Google Maps não está disponível!", Toast.LENGTH_LONG).show();
}
    
18.10.2015 / 20:59