It seems like the main problem is that you're initiating IAB from an 
activity, not a service. Activity lifetime is governed primarily by user 
actions, so an activity is rarely the right container for something that 
needs to respond to events that aren't initiated by the user.

On Tuesday, September 24, 2013 7:35:26 PM UTC-7, Ted Hopp wrote:
>
> In testing an app with in-app billing, we found a nasty problem that 
> occurs if there is a configuration change while a purchase flow is in 
> progress. The initiating activity is destroyed and restarted, breaking the 
> link from Google checkout process to the activity. To the user, it appears 
> that the purchase flow is intact, but when the purchase is complete, the 
> activity does not receive a result; hence the app is not informed of the 
> purchase. This results in a very bad user experience--the user has spent 
> money, but the app behaves as if it didn't happen! (If the user exits the 
> app and restarts, it will re-query IAB and notice the change, but that's 
> not a viable solution.)
>
> I suppose I could declare in the manifest that the activity that initiates 
> the purchase will handle all configuration changes internally, but that 
> seems rather extreme (not to mention difficult to implement, as we 
> currently rely on the restart to recreate the activity with the correct 
> resources).
>
> Are there any recommended best practices for how to deal with this?
>
> I should note that we also implemented in-app purchasing for the Amazon 
> Appstore version of the app. Their library does not seem to have the same 
> problem: the user can start a purchase, change device orientation, and 
> complete the transaction, and the activity correctly receives the result.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to