0

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Kshitij
  • 31
  • 1
  • 7

2 Answers2

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
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