1

I have an app which provides in-app purchase to unlock few features. Based on which features are purchased, the app might need to switch layouts. So, the main activity on start makes this check by calling getPurchases(). Since this call is over network so I need to show a loading dialog until I get a response. I can then store this info in memory for the rest of the session.

However, my worry is bad user experience. Every time the app starts the user will be greeted with the loading dialog, which seems bad. Furthermore, if at that moment if the internet is down then the user could be stuck at loading for a really long time (until that times out), and then the app will behave as if he did not make any purchases.

Alternatively I can choose to store the purchase history as flags in Android sqllite DB. So, the app will fetch the details from Google Billing API if that is not already in DB. If the flags are set then the app will skip this check. However, my worry is that users with rooted phones might then be able to simply turn on these flags.

How are fellow developers handling this?

AppleGrew
  • 9,302
  • 24
  • 80
  • 124

1 Answers1

0

I'm following the android developer training for in-app billing, it doesn't seem like you're following the same documentation, because there doesn't appear to be a getPurchases() method. Nonetheless, you are right to be concerned that network calls have a negative impact on the user experience and this can be avoided by threading. There's no need to right the code yourself, just following the android documentation and take a look at the sample code <<android-sdk>>/extras/google/play_billing/samples/TrivialDrive/src/com/example/android/trivialdrivesample, which will be available once you have installed the necessary packages.

As for your concerns about rooted phones, I suspect they cannot be economically justified, that is, the cost to defend your app will probably be greater than any expected loses due to rooted phones.

user2768
  • 794
  • 8
  • 31