I am considering having my own website to sell my android app. After someone purchase my app I want that user's device id to be stored on my server so that when my app sends licensing data to my server, I have that device's id already store there. My app will verify that device id and will allow further access to the app. So my question is, that is there any way I could fetch the unique device id of the device which actually pays for my app on my website?? Every answer is appreciated.
Asked
Active
Viewed 319 times
0
2 Answers
0
you can use this code :
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
but you have to use it at your own risk! and I think it's no longer unique from android 4.2

Mohammad Rahchamani
- 5,002
- 1
- 26
- 36
-
I am also considering fetching primary google account and IMSI code to uniquely identify the device. That will serve the solution i guess. Also is this possible to fetch these thing when a user visits my website before he pays? – Kshitij Sep 19 '14 at 06:32
-
you can't do that, or I don't know how to do that! – Mohammad Rahchamani Sep 19 '14 at 19:59
-
i will do more research on it...thanks you for the help. – Kshitij Sep 23 '14 at 20:40
0
You can use this:
TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService (Context.TELEPHONY_SERVICE);
String tmDeviceId = "" + tm.getDeviceId();

Misagh Emamverdi
- 3,654
- 5
- 33
- 57
-
can this be done via http requests before my app is installed?? I mean to say that just after the device purchase the app on my website and before he install it, I want to fetch these details and store on server. Later when user install the app before his first run the app will check with the server for his android id and primary google account to verify those details that my website fetched when he bought the app. Is this possible? – Kshitij Sep 19 '14 at 06:28
-
No, It is not possible. So you should change your question because you want to get device unique id on your website and it is not related to android at all because the app hasn't installed yet. – Misagh Emamverdi Sep 19 '14 at 07:07