Nicky Puff Nicky Puff - 1 year ago 113
Android Question

How to Open and Directing Google Maps using Intent?

I have a problem to let Google Maps playing automatically after opened...

Example: I have put intent code and yes it will open Google maps according to my latitude and longitude...
But, I still need to press a button to start Google Maps to direct me.
How can I make Google Map open automatically after opened by intent without pressed by users? Is it possible ?

Here is my code,

private void turnOnMap()
String labelMap = "Target";
String geouri = "geo:0,0?q=-6.908572,107.610923(XXI)";
Intent mapInt = new Intent(Intent.ACTION_VIEW, Uri.parse(geouri));

I got some information of intent code from these
open google maps through intent for specific location in android
and Android - How to launch Google map intent in android app with certain location, zoom level and marker and also latest uri from official android site

And, they don't explain what command should I add to play Google Maps automatically after opened...

Hope you can help me guys... Thank you very much for your time and information

Answer Source
String strUri = "" + latitude + "," + longitude + " (" + yourLocationName + ")";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
intent.setClassName("", "");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download