1

I am building an app that collects information on the user's use in the app. I want to recognize the device that used the app according to device id or something like that... what's the easiest way to do it?

davidmoshko
  • 223
  • 1
  • 4
  • 8

2 Answers2

1

You can get device id, sim serial number, and android id.

TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
String device_id = tm.getDeviceId();
String serial_number = tm.getSimSerialNumber();
String android_id = android.provider.Settings.Secure.getString(this.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
Ellie Zou
  • 2,021
  • 2
  • 16
  • 21
1

You can use Settings.Secure#ANDROID_ID It returns 64 hex String

import android.provider.Settings.Secure;

private String android_id = Secure.getString(getContext().getContentResolver(),
                                                    Secure.ANDROID_ID);
Eslam El-Meniawy
  • 105
  • 1
  • 2
  • 8