ইন-অ্যাপ পর্যালোচনাগুলিকে একীভূত করুন (কোটলিন বা জাভা)

এই নির্দেশিকায় বর্ণনা করা হয়েছে কিভাবে Kotlin অথবা Java ব্যবহার করে আপনার অ্যাপে ইন-অ্যাপ রিভিউ যুক্ত করবেন। আপনি যদি নেটিভ কোড , Unity বা Unreal Engine ব্যবহার করেন, তবে তার জন্য আলাদা ইন্টিগ্রেশন নির্দেশিকা রয়েছে।

আপনার উন্নয়ন পরিবেশ সেট আপ করুন

প্লে ইন-অ্যাপ রিভিউ লাইব্রেরিটি গুগল প্লে কোর লাইব্রেরির একটি অংশ। প্লে ইন-অ্যাপ রিভিউ লাইব্রেরিটি ইন্টিগ্রেট করতে নিম্নলিখিত গ্রেডল ডিপেন্ডেন্সিটি অন্তর্ভুক্ত করুন।

গ্রুভি

// 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'
    ...
}

কোটলিন

// 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 হলো সেই ইন্টারফেস যা আপনার অ্যাপকে একটি ইন-অ্যাপ রিভিউ প্রক্রিয়া শুরু করতে দেয়। ReviewManagerFactory ব্যবহার করে এর একটি ইনস্ট্যান্স তৈরি করে এটি পাওয়া যায়।

কোটলিন

val manager = ReviewManagerFactory.create(context)

জাভা

ReviewManager manager = ReviewManagerFactory.create(context)

একটি ReviewInfo অবজেক্টের জন্য অনুরোধ করুন

আপনার অ্যাপের ইউজার ফ্লো-এর ভালো মুহূর্তগুলো চিহ্নিত করতে এবং ব্যবহারকারীকে রিভিউ দেওয়ার জন্য অনুরোধ জানাতে (উদাহরণস্বরূপ, যখন ব্যবহারকারী কোনো গেমের একটি লেভেল সম্পন্ন করে) কখন ইন-অ্যাপ রিভিউয়ের জন্য অনুরোধ করতে হবে, সেই সংক্রান্ত নির্দেশিকা অনুসরণ করুন। যখন আপনার অ্যাপ এই ধরনের কোনো একটি পর্যায়ে পৌঁছায়, তখন একটি রিকোয়েস্ট টাস্ক তৈরি করতে ReviewManager ইনস্ট্যান্সটি ব্যবহার করুন। সফল হলে, ইন-অ্যাপ রিভিউ ফ্লো শুরু করার জন্য প্রয়োজনীয় ReviewInfo অবজেক্টটি API রিটার্ন করে।

কোটলিন

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 ইনস্ট্যান্সটি ব্যবহার করুন। ব্যবহারকারী অ্যাপের ভেতরের রিভিউ প্রক্রিয়াটি সম্পন্ন না করা পর্যন্ত অপেক্ষা করুন, এরপর আপনার অ্যাপ তার স্বাভাবিক কার্যক্রম (যেমন পরবর্তী লেভেলে যাওয়া) চালিয়ে যাবে।

কোটলিন

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.
});

পরবর্তী পদক্ষেপ

আপনার ইন্টিগ্রেশনটি সঠিকভাবে কাজ করছে কিনা তা যাচাই করতে আপনার অ্যাপের ইন-অ্যাপ রিভিউ ফ্লো পরীক্ষা করুন