After buy from codecanyon I configure the app and everything was fine. Now I wast to show Rewarded ads when use click on the exit button.
Add the below line of code to add this function.
override fun onBackPressed() { if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.START)) run { mBinding.drawerLayout.closeDrawer(GravityCompat.START) } else if (mBinding.drawerLayout.isDrawerOpen(GravityCompat.END)) run { mBinding.drawerLayout.closeDrawer(GravityCompat.END) } else if (mBinding.webView.canGoBack()) { mBinding.webView.goBack() } else { if (isDoubleBackToExit) { super.onBackPressed() } try { if(mRewardedVideoAd != null){ if(isApplicationAlive) mRewardedVideoAd!!.show(this@HomeActivity) { fun onUserEarnedReward(rewardItem: RewardItem) { val rewardAmount = rewardItem.amount val rewardType = rewardItem.type Log.d(TAG, "Reward type: $rewardType") Log.d(TAG, "Reward amount: $rewardAmount") } } } }catch (ex: java.lang.Exception){ ex.printStackTrace() } isDoubleBackToExit = true UtilMethods.showSnackbar(mBinding.rootContainer, getString(R.string.massage_exit)) Handler().postDelayed({ run { isDoubleBackToExit = false } }, 2000) } }
there is conflicting overload error while building apk after putting this code
Conflicting overloads: public open fun onBackPressed():
You need to update the code no need to paste again.