Android Google Maps V2 Navigation
I'm using google map v2 for showing locations in my application. When I want to navigate to that particular location I use the following code which starts the default navigation ap
Solution 1:
Is there any chance that I can do this navigation within the google map which is shown in my application itself?
Unfortunately no. Google does not expose turn-by-turn navigation engine, so the maximum you can get with Google Map V2 is display route using route points returned from Route API. Actual turn-by-turn needs to be done via proprietary Google Navigation app
Solution 2:
Yes you can display map in our application using MapFragment. Below is an example for such a activity inside which you can add the mapfragment.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/fragmap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
EDIT: for directions use this-
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="
+ destLat + ","
+ destLong + "&daddr="
+ srcLat + "," + strLong));
startActivity(intent);
Post a Comment for "Android Google Maps V2 Navigation"