I am planning to use the BillingClient SDK in my Android app to fetch the user's Play Store region. However, my app does not include any in-app purchasing features.
Is it still acceptable to use the BillingClient SDK for this purpose, or would it violate Google Play policies?
Would my app risk rejection if I integrate BillingClient solely for retrieving the store region?
Any insights or alternative solutions would be greatly appreciated.
in build.gradle(app)
implementation "com.android.billingclient:billing:6.1.0"
code:
object PlayStoreUtil {
@JvmStatic
fun fetchPlayStoreRegion(context: Context, callback: PlayStoreRegionCallback) {
val purchasesUpdatedListener = PurchasesUpdatedListener { _, _ ->
}
val billingClient = BillingClient.newBuilder(context)
.setListener(purchasesUpdatedListener)
.enablePendingPurchases()
.build()
billingClient.startConnection(object : BillingClientStateListener {
override fun onBillingSetupFinished(billingResult: BillingResult) {
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
val billingConfigParams = GetBillingConfigParams.newBuilder().build()
billingClient.getBillingConfigAsync(billingConfigParams) { _, billingConfig ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && billingConfig != null) {
val playStoreCC = billingConfig.countryCode
callback.onCountryCodeFetched(playStoreCC)
} else {
callback.onFailure()
}
}
billingClient.endConnection()
} else {
callback.onFailure()
billingClient.endConnection()
}
}
override fun onBillingServiceDisconnected() {
callback.onFailure()
billingClient.endConnection()
}
})
}
}
interface PlayStoreRegionCallback {
fun onCountryCodeFetched(countryCode: String)
fun onFailure()
}
Before implementing it, I want to ensure that my app won’t face rejection for integrating BillingClient without in-app purchases. I don't think there is actually an alternative way for this...does someone know anything about this ??