Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user canceled #517

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gen/
!.idea/codeStyleSettings.xml
build
local.properties
gradle.properties
#gradle.properties
.gradle
*.iml
.DS_Store
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Project-wide Gradle settings.

android.useAndroidX=true
android.enableJetifier=true


Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,20 @@ else if (responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED)
handleItemAlreadyOwned(purchasePayload.split(":")[1]);
savePurchasePayload(null);
}

reportBillingError(responseCode, new Throwable(billingResult.getDebugMessage()));

}
else if (responseCode == BillingClient.BillingResponseCode.USER_CANCELED
|| responseCode == BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE
|| responseCode == BillingClient.BillingResponseCode.BILLING_UNAVAILABLE
|| responseCode == BillingClient.BillingResponseCode.ITEM_UNAVAILABLE
|| responseCode == BillingClient.BillingResponseCode.DEVELOPER_ERROR
|| responseCode == BillingClient.BillingResponseCode.ERROR
|| responseCode == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED should be removed here as it is already handled in the else branch above

|| responseCode == BillingClient.BillingResponseCode.ITEM_NOT_OWNED)
{
reportBillingError(responseCode, new Throwable(billingResult.getDebugMessage()));
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
* a purchase from the google play store on his own
* server. An example implementation of how to verify
* a purchase you can find here:
* <pre>
* See <a href="https://github.com/mgoldsborough/google-play-in-app-billing-verification/blob/
* master/library/GooglePlay/InAppBilling/GooglePlayResponseValidator.php#L64"> here </a>
* </pre>
*/
public class PurchaseInfo implements Parcelable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class MainActivity extends Activity {
// PRODUCT & SUBSCRIPTION IDS
private static final String PRODUCT_ID = "com.anjlab.test.iab.s2.p5";
private static final String SUBSCRIPTION_ID = "com.anjlab.test.iab.subs1";
private static final String LICENSE_KEY = BuildConfig.licenceKey; // PUT YOUR MERCHANT KEY HERE;
private static final String LICENSE_KEY = "THE_KEY"; //BuildConfig.LICENSE_KEY; // PUT YOUR MERCHANT KEY HERE;
// put your Google merchant id here (as stated in public profile of your Payments Merchant Center)
// if filled library will provide protection against Freedom alike Play Market simulators
private static final String MERCHANT_ID=null;
Expand Down