इस गाइड में, Kotlin या Java का इस्तेमाल करके, अपने ऐप्लिकेशन में इन-ऐप्लिकेशन समीक्षाओं को इंटिग्रेट करने का तरीका बताया गया है. अगर नेटिव कोड, Unity या Unreal Engine का इस्तेमाल किया जा रहा है, तो इंटिग्रेशन के लिए अलग-अलग गाइड उपलब्ध हैं.
डेवलपमेंट एनवायरमेंट सेट अप करना
Play In-App Review Library, Google Play Core libraries का हिस्सा है. Play In-App Review Library को इंटिग्रेट करने के लिए, यहां दी गई Gradle डिपेंडेंसी शामिल करें.
Groovy
// 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.2' // For Kotlin users also add the Kotlin extensions library for Play In-App Review: implementation 'com.google.android.play:review-ktx:2.0.2' ... }
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.2") // For Kotlin users also import the Kotlin extensions library for Play In-App Review: implementation("com.google.android.play:review-ktx:2.0.2") ... }
ReviewManager ऑब्जेक्ट बनाना
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. });
अगले चरण
अपने ऐप्लिकेशन में, ऐप्लिकेशन की समीक्षा करने की सुविधा के फ़्लो की जांच करें. इससे यह पुष्टि की जा सकेगी कि आपका इंटिग्रेशन सही तरीके से काम कर रहा है.