تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تُعد RxJava مكتبة برمجة تفاعلية لإنشاء برامج غير متزامنة وقائمة على الأحداث من خلال
باستخدام تسلسلات قابلة للملاحظة.
مكتبة Rx للخرائط
تتيح لك تلقّي تسلسلات قابلة للملاحظة للأحداث غير المتزامنة على حزمة تطوير البرامج بالاستناد إلى بيانات "خرائط Google" لنظام التشغيل Android
و Places SDK لنظام التشغيل Android حتى تتمكن من الاستفادة من مجموعة ميزات RxJava الغنية.
تثبيت
لتثبيت مكتبة Rx في "خرائط Google" في مشروعك على "خرائط Google":
أضِف التبعيات التالية إلى ملف build.gradle على مستوى الوحدة:
dependencies {// RxJava bindings for the Maps SDKimplementation("com.google.maps.android:maps-rx:1.0.0")// RxJava bindings for the Places SDKimplementation("com.google.maps.android:places-rx:1.0.0")// It is recommended to also include the latest Maps SDK, Places SDK and RxJava so you// have the latest features and bug fixes.implementation("com.google.android.gms:play-services-maps:19.2.0")implementation("com.google.android.libraries.places:places:4.3.1")implementation("io.reactivex.rxjava3:rxjava:3.1.8")
أعِد إنشاء مشروعك في "استوديو Android" لمزامنة هذه التغييرات.
مثال على الاستخدام
تلقّي عنصر قابل للملاحظة لأحداث النقر على العلامة كوظيفة إضافة على كائن GoogleMap:
googleMap.markerClickEvents().subscribe { marker ->
Log.d("MapsRx", "Marker ${marker.title} was clicked")}
يوضح المثال التالي كيف يمكنك استخدام عامل تشغيل RxJava، merge، لدمج
أحداث مختلفة للكاميرا في بث واحد يمكن ملاحظته:
Observable.merge(googleMap.cameraIdleEvents(),googleMap.cameraMoveEvents(),googleMap.cameraMoveCanceledEvents(),googleMap.cameraMoveStartedEvents()).subscribe {// Notified when any camera event occurs}
تاريخ التعديل الأخير: 2025-07-16 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-16 (حسب التوقيت العالمي المتفَّق عليه)"],[[["The Maps Rx library enables the use of RxJava with the Maps SDK and Places SDK for Android to handle asynchronous events."],["It provides observable sequences for events like marker clicks and camera movements, allowing developers to leverage RxJava features."],["You can install the library by adding specific dependencies to your `build.gradle` file and rebuilding your project."],["The library offers extension functions and operators to simplify the integration of RxJava with Google Maps functionality."]]],["The Maps Rx library, designed for use with RxJava, allows developers to receive observable sequences for asynchronous events on the Maps SDK and Places SDK for Android. To install, add dependencies for `maps-rx`, `places-rx`, and the latest `Maps SDK`, `Places SDK`, and `RxJava` to the `build.gradle` file, then rebuild the project. Developers can subscribe to events, like marker clicks, using extension functions. The library also supports merging multiple event types, such as various camera events, into a single observable stream using RxJava operators.\n"]]