0

I have been trying to develop an in app billing feature in my app and even though using headless fragment to actual do the in app billing, makes more sense after seeing this - http://androidsrc.net/handle-android-asynctask-configuration-change-using-fragment/

I am not sure, how to handle the scenario where the original activity which held the headless fragment and invoked the Async task for in app billing purchase, is completely killed (while the purchase was in progress) and a completely new and different activity has been started by user.

My activity doesn't allow rotation, but I know configuration changes can occur due to various reasons + the user can also completely switch over to different activity. How to handle that scenario?

omkar.ghaisas
  • 235
  • 5
  • 19

1 Answers1

0

You will need to perform the purchase logic in a scope that has a lifetime that's longer than a single activity.

Generally, your choices are a service, or a thread controlled by the Application class.

GreyBeardedGeek
  • 29,460
  • 2
  • 47
  • 67
  • Do you have some sample reference that I can look at for the in app billing (mostly any async process initiated from google services) and handled in the activity or fragment? As I remember the problem I saw last time, when handling thru service is being able to post back the result to the initiating activity (which may have completely died by then and service has no idea about that). – omkar.ghaisas Sep 09 '15 at 00:18