# Purchase Dialog is only visible if I background the app once

**URL:** <https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608>\
**Category:** Q&A\
**Tags:** appstore-iap\
**Created:** [November 16, 2024, 6:20pm UTC](https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608 "2024-11-16T18:20:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxview](https://dhm3gbtzu79o6.cloudfront.net/user_avatar/community.amazondeveloper.com/foxview/32/1716_2.png) [@foxview](https://community.amazondeveloper.com/u/foxview)\
**Post date:** [November 16, 2024, 6:20pm UTC](https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608/1 "2024-11-16T18:20:51Z")

</div>

Hello,

I have a very weird issue that I couldn’t find a way around. I use GameMaker and an Amazon Appstore implementation. Everything works perfectly. I can get the previous purchases, SKU data etc.

However, on Live App Test (and Production as it appears), I have an issue. PurchasingService.purchase doesn’t show the purchase dialog.

If I background my app once and foreground it again, I can now normally invoke the dialog and everything works fine.

What could be the cause?

Additional Info: This behaviour doesn’t happen on App Tester with debug mode. Only in production and Live App Testing.

---

<div class="post-metadata">

**Author:** ![foxview](https://dhm3gbtzu79o6.cloudfront.net/user_avatar/community.amazondeveloper.com/foxview/32/1716_2.png) [@foxview](https://community.amazondeveloper.com/u/foxview)\
**Post date:** [November 18, 2024, 10:03am UTC](https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608/2 "2024-11-18T10:03:28Z")

</div>

Note: I have narrowed down the issue - that Amazon Appstore SDK believes that the UI is not visible at the beginning. Therefore, it puts the order in a queue until the UI is visible again.

Backgrounding and foregrounding the app resets the Appstore SDK UI setting, therefore makes it believe that the UI is visible.

Not sure how I can fix that

---

<div class="post-metadata">

**Author:** ![foxview](https://dhm3gbtzu79o6.cloudfront.net/user_avatar/community.amazondeveloper.com/foxview/32/1716_2.png) [@foxview](https://community.amazondeveloper.com/u/foxview)\
**Post date:** [November 19, 2024, 6:10pm UTC](https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608/3 "2024-11-19T18:10:34Z")

</div>

Solution is found for the issue.

For anyone encounters this in the future: Make sure that you register the PurchaseListener in the main activity’s onCreate, otherwise the Amazon Appstore SDK believes that the UI is not visible.

---

<div class="post-metadata">

**Author:** ![system](https://dhm3gbtzu79o6.cloudfront.net/user_avatar/community.amazondeveloper.com/system/32/5065_2.png) [@system](https://community.amazondeveloper.com/u/system)\
**Post date:** [December 3, 2024, 6:11pm UTC](https://community.amazondeveloper.com/t/purchase-dialog-is-only-visible-if-i-background-the-app-once/7608/4 "2024-12-03T18:11:23Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
