get Device Description - Android Phone

Android examples for Phone:Phone Information

Description

get Device Description

Demo Code


//package com.java2s;

import android.annotation.SuppressLint;

import android.os.Build;

public class Main {
    static String deviceDesc = null;

    @SuppressLint("NewApi")
    public static String getDeviceDescription() {
        if (deviceDesc == null) {
            StringBuffer sb = new StringBuffer();

            sb.append('\n');
            sb.append('\t').append("Build.MANUFACTURER\t")
                    .append(Build.MANUFACTURER).append('\n');
            sb.append('\t').append("Build.MODEL\t").append(Build.MODEL)
                    .append('\n');
            sb.append('\t').append("Build.PRODUCT\t").append(Build.PRODUCT)
                    .append('\n');
            sb.append('\t').append("Build.DEVICE\t").append(Build.DEVICE)
                    .append('\n');
            sb.append('\t').append("Build.BOARD\t").append(Build.BOARD)
                    .append('\n');
            sb.append('\t').append("Build.BRAND\t").append(Build.BRAND)
                    .append('\n');
            sb.append('\t').append("Build.CPU_ABI\t").append(Build.CPU_ABI)
                    .append('\n');
            sb.append('\t').append("Build.DISPLAY\t").append(Build.DISPLAY)
                    .append('\n');
            sb.append('\t').append("Build.FINGERPRINT\t")
                    .append(Build.FINGERPRINT).append('\n');
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
                sb.append('\t').append("Build.HARDWARE\t")
                        .append(Build.HARDWARE).append('\n');
                sb.append('\t').append("Build.RADIO\t").append(Build.RADIO)
                        .append('\n');
            }/* ww  w . j av a  2 s  .co m*/
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
                sb.append('\t').append("Build.SERIAL\t")
                        .append(Build.SERIAL).append('\n');
            }
            sb.append('\t').append("Build.TAGS\t").append(Build.TAGS)
                    .append('\n');
            sb.append('\t').append("Build.TYPE\t").append(Build.TYPE)
                    .append('\n');
            sb.append('\t').append("Build.SDK_INT\t")
                    .append(Build.VERSION.SDK_INT).append('\n');

            deviceDesc = sb.toString();
        }

        return deviceDesc;
    }
}

Related Tutorials