google maps - Is API Key Required for Direction Apis Android -
i using below code directions particular lat & lng using google api. have not used api key. app making pushed playstore. want make sure doing here correct or cause problem me ?
thanks in advance :)
if (pc.getlatitude() != null && pc.getlongitude() != null) { double latitude = double.parsedouble(pc.getlatitude()); double longitude = double.parsedouble(pc.getlongitude()); string uri = string.format(locale.english, "http://maps.google.com/maps?daddr=%f,%f (%s)", latitude, longitude, "location"); intent intent = new intent(intent.action_view, uri.parse(uri)); intent.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivity"); if (intent.resolveactivity(mcontext.getpackagemanager()) != null) { toast.maketext(mcontext, r.string.toast_opening_google_maps, toast.length_short).show(); mcontext.startactivity(intent); } else { toast.maketext(mcontext, r.string.toast_no_google_maps_warning, toast.length_short).show(); } } else { toast.maketext(mcontext, r.string.toast_no_ll_warning, toast.length_long).show(); }
this 1 more example of api usage
string distanceurl = "http://maps.googleapis.com/maps/api/distancematrix/json?" + "origins=" + moriginlatlng.latitude + "," + moriginlatlng.longitude + "&destinations=" + destination.latitude + "," + destination.longitude + "&mode=driving&language=en-en&sensor=false";
according the documentation, don't need api key launch google maps using intent.
according the documentation, need api key use distance matrix api.
Comments
Post a Comment