Where is BILLING_RESULT_OK defined?
I believe that's a typo in the documentation. Instead, you should use BillingResponse.OK
: https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponse#ok
You can see it in use in this example: https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive_v2/shared-module/src/main/java/com/example/billingmodule/billing/BillingManager.java#L126
in 2019 running 'com.android.billingclient:billing:2.0.1'
replace:
BillingResponse.OK
with
BillingClient.BillingResponseCode.OK
The whole documentation feels very unprecise. Shocking to see how weak Google handles this.
For me useing BillingClient.BillingResponse.OK
did not work, it always acts like if the feature is not supported. I had to use this:
int response = billingClient.isFeatureSupported(BillingClient.FeatureType.SUBSCRIPTIONS);
if (response == BillingClient.BillingResponse.FEATURE_NOT_SUPPORTED) {
Toast.makeText(this, "Feature not supported", Toast.LENGTH_SHORT).show();
return;
}