'Android Management API device list getUser

I'm having trouble when I want getUser or getUserAccountdentifier.

I can setUser at enrollmentTokens , but when I get devices list , the list doesn't have User or UserAccountdentifier.

So I want to getuser , but the response is nullpoint, I don't know what has happened.

This is my code:

List<Device> devices = listDevices(enterpriseName);
    for (Device device : devices) {
        System.out.println("Found device with name: " + device.getName());
        System.out.println("Found device with userId: " + device.getUser().getAccountIdentifier()); 
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source