Retrieve a BlackBerry device ID

To search for a specific BlackBerry® device, use the user account assigned to the BlackBerry device.
Before you begin: Retrieve the userID integer for the user account assigned to the BlackBerry device.
  1. Invoke findDeviceForUser().
    findDeviceForUser request = new findDeviceForUser();
    request.userId = userID;
    request.locale = locale;
    request.loadDeviceServiceAttributes = true;
    findDeviceForUserResponse response = coreWebService.findDeviceForUser(request);
    findDeviceForUserResult result = response.returnValue;
    
  2. Check the result for errors and handle any errors.
    if (result.findDeviceForUserReturnStatus.code != FindDeviceForUserReturnStatusEnumType.SUCCESS)
    { 
           // handle any errors
    }
  3. Verify that there is a BlackBerry device assigned to the the user account.
    if (result.device == null)
    { 
           // notify the user
    }
  4. Return the BlackBerry device ID.
    int deviceID = result.device.deviceID;
    return deviceID;

Was this information helpful? Send us your comments.