Q:

How to add pin point on Google Map using package (when you click on a button, it open directly to Google Map App) on android studio

I have trouble with adding the pin point on Google Map using package for opening Google Map App to show the point of location on android studio. Here is the code
Uri gmmIntentUri = Uri.parse("geo:"+29.972653+","+31.283936);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

A:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<" + latitude + ">,<" + longitude + ">?q=<" + latitude + ">,<" + longitude()));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

try {
    context.startActivity(intent);
} catch (ActivityNotFoundException ex) {

    String urlAddress = "http://maps.google.com/maps?q=" + latitude + "," + longitude;
    Intent intents = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAddress));
    context.startActivity(intents);
}

It will check if GoogleMaps application is installed or not and if not then redirect you to browser

