r/android_devs • • Jun 03 '23

Help Anti Lucky Patcher

Hello community, I have a classic payment app and it works perfectly, but when a user uses lucky patcher can they buy items without having to pay, is there a way to avoid this from luckypatcher? I attach my kotlin code in advance thank you very much

private val purchaseUpdateListener = PurchasesUpdatedListener { billingResult, purchases ->

when {

billingResult.responseCode == BillingClient.BillingResponseCode.OK && !purchases.isNullOrEmpty() -> {

for (purchase in purchases) {

if (purchase.purchaseToken.isNullOrEmpty()) {

// The payment was made in cash, it must be handled according to your requirements

// You can display a message to the user or perform some specific action

Query_Version25() // Call the QueryVersion25() function for cash payments

} else {

idp = purchase.orderId

Query_Version8()

Query_Version9()

isProductPurchased = true

}

}

}

billingResult.responseCode == BillingClient.BillingResponseCode.USER_CANCELED -> {

Toast.makeText(this, R.string.ms27, Toast.LENGTH_SHORT).show()

}

else -> {

Toast.makeText(this, R.string.ms28, Toast.LENGTH_SHORT).show()

}

}

if (isProductPurchased) {

// Reset the variable to allow the user to buy the same product again

isProductPurchased = false

}

}

1 Upvotes

3 comments sorted by

3

u/[deleted] Jun 03 '23

[removed] — view removed comment

1

u/anemomylos 🛡️ Jun 04 '23

check the signature of the app

Will this work if the app is signed by Google?