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 adding pin point on google map using package opening google map app show point of location on android studio. here 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);
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 check if googlemaps application installed or not , if not redirect browser
Comments
Post a Comment