Android Utililty Methods Device Information Get

List of utility methods to do Device Information Get

Description

The list of methods to do Device Information Get are organized into topic(s).

Method

StringgetDeviceType(Context ctx)
get Device Type
if (isTablet(ctx))
    return "Tablet";
else
    return "Phone";
StringgetDeviceModel()
get Device Model
return Build.MODEL;
intgetDeviceCpuCores()
Gets the number of cores available in this device, across all processors.
class CpuFilter implements FileFilter {
    @Override
    public boolean accept(File pathname) {
        if (Pattern.matches("cpu[0-9]", pathname.getName())) {
            return true;
        return false;
try {
    File dir = new File("/sys/devices/system/cpu/");
    File[] files = dir.listFiles(new CpuFilter());
    return files.length;
} catch (Exception e) {
    return Runtime.getRuntime().availableProcessors();
StringgetDeviceUniqueIdentificator( @Nonnull Context context, @Nonnull String appId)
Generates an unique, stable UID that identifies the device where the user is currently logged.
String telephonyId = null;
String androidId = null;
if (hasTelephony(context)) {
    final TelephonyManager telephony = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    telephonyId = telephony.getDeviceId();
if (telephonyId == null) {
...
booleandeviceBeRoot()
device Be Root
if (isSilent) {
    return isRootSystem();
int i = execRootCmdSilent("echo test");
if (i != -1) {
    return true;
return false;
...
intgetDeviceCpuCores()
Gets the number of cores available in this device, across all processors.
class CpuFilter implements FileFilter {
    @Override
    public boolean accept(File pathname) {
        return Pattern.matches("cpu[0-9]", pathname.getName());
try {
    File dir = new File("/sys/devices/system/cpu/");
...
Stringget_device_id(Context ctx)
gedevicid
final TelephonyManager tm = (TelephonyManager) ctx
        .getSystemService(Context.TELEPHONY_SERVICE);
String tmDevice;
String tmSerial = null;
String androidId = null;
tmDevice = "krakenmessages";
try {
    tmDevice = "" + tm.getDeviceId();
...