1

I have to add trial version in my app. User will by open my app only 9 times - then body of my application will be blocked. I read that the simplest way is usage in app billing, but my knowledge of billing is almost zero... Could you tell me how to do what i want in the simplest way?

I've trying to create simple billing helper

public BillingHelper(Context context, String skuTrial,
        int marketRequest, String publicKey, String prefsName, String tagName) {
    isSetup = true;
    TAG = tagName;
    this.context = context;
    this.skuTrial = skuTrial;
    this.marketRequest = marketRequest;
    this.publicKey = publicKey;
    this.prefsName = prefsName;
}

but i dont know what to do next...

Thanks a lot.

PS sorry for my English... ;/

Lau
  • 1,804
  • 1
  • 23
  • 49

1 Answers1

1

In-App Billing won't help you with this. You need to implement this "9-times open" logic by yourself.

Instead of this I would rather propose to implement a logic counting days since installation. For instance you hide some functions after application has been used for 2 days. You can use PackageManager to get the date of first installation.

packageManager.getPackageInfo(packageName, 0).firstInstallTime;

Or is you want to allow a user to reset this counter, you can count days since last installation as following.

PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String appFile = appInfo.sourceDir;
long installed = new File(appFile).lastModified();

Source: How to get app install time from android

Community
  • 1
  • 1
sergej shafarenka
  • 20,071
  • 7
  • 67
  • 86