-2

I have a problem in my android app, I am sending device Id to server and they make it as unique identifier , some hacker are able to root android device and change the device Id of other devices, can any one tell me how to make sure this is the read device Id or a fake one

Phantômaxx
  • 36,442
  • 21
  • 78
  • 108
Amira Elsayed Ismail
  • 8,304
  • 26
  • 74
  • 144
  • You can use IMEI number as device id which is also unique. Send it to server and map device there. It do not change whether the device is rooted or unrooted. – Iamat8 Feb 10 '18 at 16:46

1 Answers1

0

You can check whether phone is rooted or not.

public static boolean isRooted() {
        return findBinary("su");
    }

    public static boolean findBinary(String binaryName) {
        boolean found = false;
        if (!found) {
            String[] places = { "/sbin/", "/system/bin/", "/system/xbin/",
                    "/data/local/xbin/", "/data/local/bin/",
                    "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/" };
            for (String where : places) {
                if (new File(where + binaryName).exists()) {
                    found = true;
                    break;
                }
            }
        }
        return found;
    }
Lokesh Deshmukh
  • 493
  • 4
  • 8