इस गाइड में, इनमें से किसी एक का इस्तेमाल करके, आपके ऐप्लिकेशन में इन-ऐप्लिकेशन समीक्षाओं को इंटिग्रेट करने का तरीका बताया गया है Kotlin या Java. अगर नेटिव नेटिव लिंक" का इस्तेमाल किया जा रहा है, तो आपको इंटिग्रेशन गाइड का इस्तेमाल करना होगा कोड या Unity.
अपना डेवलपमेंट एनवायरमेंट सेट अप करें
Play की इन-ऐप्लिकेशन समीक्षा लाइब्रेरी, Google Play Core लाइब्रेरी का हिस्सा है. Play इन-ऐप्लिकेशन को इंटिग्रेट करने के लिए, कृपया इस Gradle डिपेंडेंसी को शामिल करें लाइब्रेरी देखें.
ग्रूवी
// In your app’s build.gradle file: ... dependencies { // This dependency is downloaded from the Google’s Maven repository. // So, make sure you also include that repository in your project's build.gradle file. implementation 'com.google.android.play:review:2.0.1' // For Kotlin users also add the Kotlin extensions library for Play In-App Review: implementation 'com.google.android.play:review-ktx:2.0.1' ... }
Kotlin
// In your app’s build.gradle.kts file: ... dependencies { // This dependency is downloaded from the Google’s Maven repository. // So, make sure you also include that repository in your project's build.gradle file. implementation("com.google.android.play:review:2.0.1") // For Kotlin users also import the Kotlin extensions library for Play In-App Review: implementation("com.google.android.play:review-ktx:2.0.1") ... }
समीक्षा मैनेजर बनाएं
ReviewManager
ऐसा इंटरफ़ेस है जिसकी मदद से आपका ऐप्लिकेशन, इन-ऐप्लिकेशन समीक्षा की प्रोसेस शुरू कर सकता है. इसे हासिल करें
ReviewManagerFactory
का इस्तेमाल करके इंस्टेंस बनाया जा रहा है.
Kotlin
val manager = ReviewManagerFactory.create(context)
Java
ReviewManager manager = ReviewManagerFactory.create(context)
ReviewInfo ऑब्जेक्ट का अनुरोध करें
ऐप्लिकेशन में अनुरोध कब करें, इस बारे में दिए गए दिशा-निर्देशों का पालन करें
समीक्षाएं लिखें, ताकि अच्छे पॉइंट तय किए जा सकें
उपयोगकर्ता को समीक्षा का प्रॉम्प्ट भेजने के लिए, अपने ऐप्लिकेशन के यूज़र फ़्लो में. उदाहरण के लिए,
उपयोगकर्ता, गेम के किसी लेवल को पूरा करता है. जब आपका ऐप्लिकेशन इनमें से किसी एक पॉइंट पर पहुंच जाए,
ReviewManager
का इस्तेमाल करें
इंस्टेंस का इस्तेमाल करके,
अनुरोध के लिए टास्क बनाना होता है. कामयाब होने पर, एपीआई
ReviewInfo
ऑब्जेक्ट
इन-ऐप्लिकेशन समीक्षा की प्रोसेस शुरू करने के लिए ज़रूरी है.
Kotlin
val request = manager.requestReviewFlow() request.addOnCompleteListener { task -> if (task.isSuccessful) { // We got the ReviewInfo object val reviewInfo = task.result } else { // There was some problem, log or handle the error code. @ReviewErrorCode val reviewErrorCode = (task.getException() as ReviewException).errorCode } }
Java
ReviewManager manager = ReviewManagerFactory.create(this); Task<ReviewInfo> request = manager.requestReviewFlow(); request.addOnCompleteListener(task -> { if (task.isSuccessful()) { // We can get the ReviewInfo object ReviewInfo reviewInfo = task.getResult(); } else { // There was some problem, log or handle the error code. @ReviewErrorCode int reviewErrorCode = ((ReviewException) task.getException()).getErrorCode(); } });
इन-ऐप्लिकेशन समीक्षा फ़्लो लॉन्च करें
ReviewInfo
का इस्तेमाल करें
इन-ऐप्लिकेशन समीक्षा फ़्लो को लॉन्च करने के लिए कहा जाता है. उपयोगकर्ता के पुष्टि करने की प्रक्रिया पूरी होने तक इंतज़ार करें
आपके ऐप्लिकेशन के सामान्य यूज़र फ़्लो को बनाए रखने से पहले, इन-ऐप्लिकेशन समीक्षा का फ़्लो (जैसे
अगले लेवल पर जाने में मदद मिलती है).
Kotlin
val flow = manager.launchReviewFlow(activity, reviewInfo) flow.addOnCompleteListener { _ -> // The flow has finished. The API does not indicate whether the user // reviewed or not, or even whether the review dialog was shown. Thus, no // matter the result, we continue our app flow. }
Java
Task<Void> flow = manager.launchReviewFlow(activity, reviewInfo); flow.addOnCompleteListener(task -> { // The flow has finished. The API does not indicate whether the user // reviewed or not, or even whether the review dialog was shown. Thus, no // matter the result, we continue our app flow. });
अगले चरण
अपने ऐप्लिकेशन की इन-ऐप्लिकेशन समीक्षा की प्रोसेस की जांच करना पुष्टि करें कि आपका इंटिग्रेशन सही तरीके से काम कर रहा है.