问题
I am developing a mobile app which would need constant interaction with the web site using web service. For this purpose I am planning to have some kind of unique mobile ID which can be generated at the time of application download by the user. This unique ID will be used for website login from mobile and can be sent for validation when user submits any reviews or syncs with the server.
Is it possible to generate some kind of unique license key for each download? And at the same time, pass on that unique key to the web site for user mobile registration. Does android market provides this facility ans if yes, then how?
Rgds, Sapan
回答1:
There is an official licensing platform, have you taken a look at that?
回答2:
Nice thought,even i was thinking the same concept for my android application so that people can't sell the downloaded app for free or at lower rates. one thing i would like suggest you can register the user with a unique composed key(made up of two attributs:phone number and his email-ID).
regards karanjit singh
回答3:
You can generate a unique ID when the user first logins in during the registration process. You can use the uniqid function to generate a unique id for that user. Then store the unique id in a database along with the users credentials.
回答4:
If you intend this to be seamless and behind the scenes, not requiring any user interaction, google for "UUID". There are many algorithms for implementing this, so I really won't get into it too deep here. But I have used a timestamped+extremely large random number implementation and it is working quite well so far. When the app runs, i test if it exists in the SharedPreferences
, if not, i create it, and save it in.
BEWARE of Secure.AndroidID.
it is not reliably unique unless your app ONLY runs on 2.3+.
Also remember to not try to use IMEI or other such information, because while unique for handsets that have it, is unavailable for verizon mobiles, and non-3g tablets
来源:https://stackoverflow.com/questions/6509951/android-application-unique-license-key