خرائط Google Direction API Helper for Android
نظرًا لأن الإصدار 2.1.2 سينتقل من JCenter إلى Mavencentral
// build.gradle (project)
allprojects {
repositories {
mavenCentral()
/* ... */
}
}
Gradle
implementation 'com.akexorcist:google-direction-library:1.2.1'
طلب اتجاه بسيط
GoogleDirection .withServerKey( " YOUR_SERVER_API_KEY " )
.from( LatLng ( 37.7681994 , - 122.444538 ))
.to( LatLng ( 37.7749003 , - 122.4034934 ))
.avoid( AvoidType . FERRIES )
.avoid( AvoidType . HIGHWAYS )
.execute(
onDirectionSuccess = { direction : Direction ? ->
if (direction.isOK()) {
// Do something
} else {
// Do something
}
},
onDirectionFailure = { t : Throwable ->
// Do something
}
)
طلب اتجاه نقاط الطرق المتعددة
GoogleDirection .withServerKey( " YOUR_SERVER_API_KEY " )
.from( LatLng ( 41.8838111 , - 87.6657851 ))
. and ( LatLng ( 41.8766061 , - 87.6556908 ))
. and ( LatLng ( 41.8909056 , - 87.6467561 ))
.to( LatLng ( 41.9007082 , - 87.6488802 ))
.transportMode( TransportMode . DRIVING )
.execute(
onDirectionSuccess = { direction : Direction ? ->
if (direction.isOK()) {
// Do something
} else {
// Do something
}
},
onDirectionFailure = { t : Throwable ->
// Do something
}
)
أو
val waypoints : List < LatLng > = listOf (
LatLng ( 41.8766061 , - 87.6556908 ),
LatLng ( 41.8909056 , - 87.6467561 )
)
GoogleDirection .withServerKey( " YOUR_SERVER_API_KEY " )
.from( LatLng ( 41.8838111 , - 87.6657851 ))
. and (waypoints)
.to( LatLng ( 41.9007082 , - 87.6488802 ))
.transportMode( TransportMode . DRIVING )
.execute(
onDirectionSuccess = { direction : Direction ? ->
if (direction.isOK()) {
// Do something
} else {
// Do something
}
},
onDirectionFailure = { t : Throwable ->
// Do something
}
)
انظر رمز المثال لمزيد من التفاصيل
للحصول على مفتاح API ، يرجى قراءة مفتاح API Direction Maps
جربه في Google Play
-keep class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.* { *; }
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-keep class com.akexorcist.googledirection.model.** { *;}
انظر changelog.md
حقوق الطبع والنشر 2021 Akexorcist
مرخصة بموجب ترخيص Apache ، الإصدار 2.0 ("الترخيص") ؛ لا يجوز لك استخدام هذا العمل إلا في الامتثال للترخيص. يمكنك الحصول على نسخة من الترخيص في ملف الترخيص ، أو في:
http://www.apache.org/licenses/license-2.0
ما لم يكن مطلوبًا بموجب القانون المعمول به أو الموافقة على الكتابة ، يتم توزيع البرامج الموزعة بموجب الترخيص على أساس "كما هي" ، دون ضمانات أو شروط من أي نوع ، إما صريحة أو ضمنية. راجع ترخيص الأذونات والقيود التي تحكم اللغة المحددة بموجب الترخيص.