Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What id to use to generate promo codes for android app

I am thinking of having a way in my app to offer free unlock codes for valuable users, meaning that they won't have to purchase the app to have full access to it.

Looking into it there are a few ways:

  1. Google Play Promo Codes: initially this sounded good but their terms are a bit constraining, for instance:

You agree to distribute Promotional Codes only to users located in countries where your Products, in-app item in your Products, or content related thereto, are permitted.

What if I want to reward a user from a country where I don't sell my apps to?

  1. I could generate an unlock code for the user's email... but this rises a bit of privacy issues

  2. I could have the user tell me some code from the app, and then for that code, generate an unlock code... I was thinking of maybe ANDROID_ID. Not sure what security issues may bring the read of ANDROID_ID as for instance the Advertiser id has. Another way could be generating a unique code on app install and use that.

  3. Use something like Firebase Database and then store a bunch of codes there and check if the code entered in the app is available in the server.

I am waiting for your thoughts on how to implement this for android.

like image 723
Alin Avatar asked May 01 '17 20:05

Alin


1 Answers

  • Create a table in a db somewhere, or use something like Firebase with fields [code (String), redeemed (boolean)]

  • When you want to give a promo code to a user, generate a unique promo code and insert it into the table (code, false).

  • Have the user enter the code in the app, make a request to your api/Firebase, to redeem that code, which transactionally flips redeemed to true and returns true. Upon receiving true, save something in the app to remember it has been unlocked.

Don't forget to pin the SSL cert for your api to ensure they can't fake the api calls.

or

If you are feeling lazy & don't care about security, just generate a ton of codes, hardcode them in the app, keep a copy, and hand them out to people.

like image 50
gjsalot Avatar answered Nov 07 '22 16:11

gjsalot