Kotlin বা Java ব্যবহার করে আপনার অ্যাপে কীভাবে অ্যাপ-মধ্যস্থ রিভিউ ইন্টিগ্রেট করবেন তা এই গাইডে বর্ণনা করা হয়েছে। আপনি নেটিভ কোড, Unity বা Unreal Engine ব্যবহার করলে, ইন্টিগ্রেশন সংক্রান্ত আলাদা আলাদা নির্দেশিকা আছে।
আপনার ডেভেলপমেন্ট এনভায়রনমেন্ট সেট-আপ করুন
Play অ্যাপ-মধ্যস্থ রিভিউ লাইব্রেরি হল Google Play Core লাইব্রেরির অংশ। Play In-App Review Library ইন্টিগ্রেট করতে নিম্নলিখিত 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.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)
জাভা
ReviewManager manager = ReviewManagerFactory.create(context)
ReviewInfo অবজেক্টের অনুরোধ করা
ব্যবহারকারীকে রিভিউয়ের জন্য প্রম্পট করতে আপনার অ্যাপের ইউজার ফ্লোতে ভাল পয়েন্ট নির্ধারণ করতে কখন অ্যাপ-মধ্যস্থ রিভিউয়ের জন্য অনুরোধ করতে হবে সেই সংক্রান্ত নির্দেশিকা অনুসরণ করুন (যেমন,
ব্যবহারকারী কোনও গেমে লেভেল সম্পূর্ণ করলে)। আপনার অ্যাপ এইসব পয়েন্টের কোনও একটিতে পৌঁছালে, অনুরোধ টাস্ক তৈরি করতে ReviewManager ইনস্ট্যান্স ব্যবহার করুন। সফল হলে,
API, অ্যাপ-মধ্যস্থ রিভিউ ফ্লো শুরু করার জন্য প্রয়োজনীয় 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 } }
জাভা
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. }
জাভা
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. });
পরবর্তী ধাপ
আপনার ইন্টিগ্রেশন সঠিকভাবে কাজ করছে কিনা তা যাচাই করতে আপনার অ্যাপের ইন-অ্যাপ রিভিউ ফ্লো পরীক্ষা করুন।