RxJava लाइब्रेरी
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
RxJava एक रिएक्टिव प्रोग्रामिंग लाइब्रेरी है. इसका इस्तेमाल, एसिंक्रोनस और इवेंट पर आधारित प्रोग्राम बनाने के लिए किया जाता है. इसके लिए, ऑब्ज़र्वेबल सीक्वेंस का इस्तेमाल किया जाता है.
Maps Rx लाइब्रेरी की मदद से, Android के लिए Maps SDK और Android के लिए Places SDK पर, एसिंक्रोनस इवेंट के लिए निगरानी किए जा सकने वाले क्रम मिलते हैं. इससे, RxJava की कई सुविधाओं का फ़ायदा लिया जा सकता है.
इंस्टॉल करना
अपने Google Maps प्रोजेक्ट में Maps Rx लाइब्रेरी इंस्टॉल करने के लिए:
अपनी मॉड्यूल-लेवल की build.gradle फ़ाइल में ये डिपेंडेंसी जोड़ें:
dependencies {// RxJava bindings for the Maps SDKimplementation(libs.maps.rx)// RxJava bindings for the Places SDKimplementation(libs.places.rx)// 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:20.0.0")implementation("com.google.android.libraries.places:places:5.3.0")implementation("io.reactivex.rxjava3:rxjava:3.1.12")
इन बदलावों को सिंक करने के लिए, Android Studio में अपना प्रोजेक्ट फिर से बनाएं.
इस्तेमाल से जुड़ा उदाहरण
GoogleMap ऑब्जेक्ट पर एक्सटेंशन फ़ंक्शन के तौर पर, मार्कर पर क्लिक करने के इवेंट के लिए Observable पाएं:
googleMap.markerClickEvents().subscribe { marker ->
Log.d("MapsRx", "Marker ${marker.title} was clicked")}
कैमरे के अलग-अलग इवेंट को एक Observable स्ट्रीम में जोड़ने के लिए, merge RxJava ऑपरेटर का इस्तेमाल करें:
Observable.merge(googleMap.cameraIdleEvents(),googleMap.cameraMoveEvents(),googleMap.cameraMoveCanceledEvents(),googleMap.cameraMoveStartedEvents(),).subscribe {// Notified when any camera event occurs}
[[["समझने में आसान है","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"]],["आखिरी बार 2026-11-10 (UTC) को अपडेट किया गया."],[],["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"]]