mirror of
https://github.com/Nezumi-2711/PRM392.git
synced 2026-09-22 20:00:53 +00:00
Fix direction google map
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
-->
|
-->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.geo.API_KEY"
|
android:name="com.google.android.geo.API_KEY"
|
||||||
android:value="AIzaSyApaoTIiQj-faYEkJuSlJoTHTZFC4L8CbM" />
|
android:value="AIzaSyCqmoLlawoQzmwjZI2_Yo_V33An_nNZADs" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".TrackingOrder"
|
android:name=".TrackingOrder"
|
||||||
|
|||||||
+3
-2
@@ -6,8 +6,9 @@ import retrofit2.http.Query;
|
|||||||
|
|
||||||
public interface IGeoCoordinates {
|
public interface IGeoCoordinates {
|
||||||
@GET("maps/api/geocode/json")
|
@GET("maps/api/geocode/json")
|
||||||
Call<String> getGeoCode(@Query("address") String address);
|
Call<String> getGeoCode(@Query("address") String address, @Query("key") String key);
|
||||||
|
|
||||||
@GET("maps/api/directions/json")
|
@GET("maps/api/directions/json")
|
||||||
Call<String> getDirections(@Query("origin") String origin, @Query("destination") String destination);
|
Call<String> getDirections(@Query("origin") String origin, @Query("destination") String destination,
|
||||||
|
@Query("key") String key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ public class TrackingOrder extends FragmentActivity implements OnMapReadyCallbac
|
|||||||
private static int FATEST_INTERVAL = 5000;
|
private static int FATEST_INTERVAL = 5000;
|
||||||
private static int DISPLACEMENT = 10;
|
private static int DISPLACEMENT = 10;
|
||||||
|
|
||||||
|
private static String MAP_API = "AIzaSyCqmoLlawoQzmwjZI2_Yo_V33An_nNZADs";
|
||||||
|
|
||||||
private IGeoCoordinates mService;
|
private IGeoCoordinates mService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,7 +129,7 @@ public class TrackingOrder extends FragmentActivity implements OnMapReadyCallbac
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawRoute(LatLng yourLocation, String address) {
|
private void drawRoute(LatLng yourLocation, String address) {
|
||||||
mService.getGeoCode(address).enqueue(new Callback<String>() {
|
mService.getGeoCode(address, MAP_API).enqueue(new Callback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<String> call, Response<String> response) {
|
public void onResponse(Call<String> call, Response<String> response) {
|
||||||
try {
|
try {
|
||||||
@@ -157,7 +159,7 @@ public class TrackingOrder extends FragmentActivity implements OnMapReadyCallbac
|
|||||||
|
|
||||||
//draw route
|
//draw route
|
||||||
mService.getDirections(yourLocation.latitude + ", " + yourLocation.longitude,
|
mService.getDirections(yourLocation.latitude + ", " + yourLocation.longitude,
|
||||||
orderLocation.latitude + ", " + orderLocation.longitude)
|
orderLocation.latitude + ", " + orderLocation.longitude, MAP_API)
|
||||||
.enqueue(new Callback<String>() {
|
.enqueue(new Callback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<String> call, Response<String> response) {
|
public void onResponse(Call<String> call, Response<String> response) {
|
||||||
|
|||||||
Reference in New Issue
Block a user