9

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.

Alin
  • 14,809
  • 40
  • 129
  • 218
  • I'm not sure about it but perhaps that condition in the licence is about countries where your product might be illegal. For example content that is legal for a certain age in one country might not be legal for that age in another country. – Mederr May 01 '17 at 20:33
  • You can look into using Firebase cloud functions. When a user deserves that free access code, you can call that cloud code and generate a new code to show them. I would store that code into firebase. When its actually used, you can have another boolean column in Firebase next to that and update it that it has been used. So if someone else tries to pass it over to a friend, they wouldn't be able to. – mitch94 May 01 '17 at 20:37
  • Well I don't know, I have written a week ago to support and no answer so I can't just assume what that permitted is about. My app is not available for all Google Play countries. – Alin May 01 '17 at 20:37
  • Why don't you generate all promo-codes on backend and then send it to client side? It is more safely and handy – Ilya Blokh May 29 '17 at 19:05

3 Answers3

2
  • 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.

gjsalot
  • 768
  • 7
  • 5
1

I will go with number 3 but with minor variation, Since your plan is to reward users from a country where you don't sell your apps. I would have a reward page that generates randomUUID() that gets tied to user and my cloud/server by firing a post API directly to my server with header parameters to identify as legitimately my app and legitimate user/account.

UUID

That way I can generate UUID on the devices and sync with my rewards on server.

alkathirikhalid
  • 887
  • 12
  • 18
0

what I can think of is to make a unique id (MD5 hash) for a particular user on your server side and thus having a flag for if the promo code can be applied or not.

If it (flag) changes from false to true, SMS or email the user that he can avail use of some code(sent along, generated by some algorithm on ID and credentials with a validity too) to unlock PAID content in free.

OO-> Else if you want to promote or distribute some of the promo codes like these, create a table with all the sorts of you wanted to distribute, then if any user enters that promo code, simply remove it from the promo code tables and assign that code to that respective user, if not already been used promo code ofcourse.

Prakhar Kulshreshtha
  • 1,005
  • 11
  • 21