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

Implement check if GooglePlay/Apple store is activated (installed & user signed in) #35

Open
Kebechet opened this issue Feb 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Kebechet
Copy link
Owner

Kebechet commented Feb 26, 2024

Source:
Android , iOS

Test with Android emulator where you log out from the store

Example:

            catch ( Xamarin.RevenueCat.Android.Extensions.Exceptions.PurchasesErrorException ex )
            {
                string description = ex.PurchasesError.Code.Description;
                string diagnosis = ex.PurchasesError.UnderlyingErrorMessage;        // Debug - real reason for the problem
                RevenueCatXamarin.Droid.Utilities.Show_Dialog msg = new Utilities.Show_Dialog ();
                if ( description.Contains ( "problem with the store" ) )
                {
                    description = S.StoreProblemInDetail;       // Ask user to verify logged in to Google and re-start app
                    await msg.ShowDialogAsync ( S.Warning, description );

                    // Continuing is possible in some circumstances
                    return;
                }
                else if ( ex.PurchasesError.Code == PurchasesErrorCode.PurchaseNotAllowedError )
                {
                    // Results from Google Play status BILLING_UNAVAILABLE
                    // Likely causes:
                    //      The Play Store app on the user's device is out of date
                    //      Google Play is unable to charge the user's payment method
                    //      The user is an enterprise user and their enterprise admin has disabled users from making purchases
                    //      The user is in a country not supported by Google
                    // Advise user then allow user to continue

                    string message = S.BillingUnavailable1 + Environment.NewLine  + Environment.NewLine +
				     S.BillingUnavailable2 + Environment.NewLine  + Environment.NewLine +
				     S.BillingUnavailable3 + Environment.NewLine  +
				     S.BillingUnavailable4 + Environment.NewLine  +
				     S.BillingUnavailable5 + Environment.NewLine  +
				     S.BillingUnavailable6 + Environment.NewLine + Environment.NewLine +
				     S.BillingUnavailable7;
                                 
                    await msg.ShowDialogAsync ( S.Warning, message );
                    return;
                }
[[Purchases] - ERROR] 🤖‼️ Error when fetching products DebugMessage: An internal error occurred.. ErrorCode: SERVICE_UNAVAILABLE.
[[Purchases] - ERROR] 🤖‼️ PurchasesError(code=StoreProblemError, underlyingErrorMessage=Error when fetching products. DebugMessage: An internal error occurred.. ErrorCode: SERVICE_UNAVAILABLE., message='There was a problem with the store.')
[[Purchases] - ERROR] 🤖‼️ Error fetching offerings - PurchasesError(code=StoreProblemError, underlyingErrorMessage=Error when fetching products. DebugMessage: An internal error occurred.. ErrorCode: SERVICE_UNAVAILABLE., message='There was a problem with the store.')
@Kebechet Kebechet added the enhancement New feature or request label Feb 26, 2024
@Kebechet Kebechet self-assigned this Jun 13, 2024
@Kebechet Kebechet removed their assignment Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant