Android Device Type Check getDeviceName()

Here you can find the source of getDeviceName()

Description

get Device Name

Declaration

public static String getDeviceName() 

Method Source Code

//package com.java2s;

import android.os.Build;

public class Main {
    public static String getDeviceName() {
        String manufacturer = Build.MANUFACTURER;
        String model = Build.MODEL;
        if (model.startsWith(manufacturer)) {
            return capitalize(model);
        } else {//from ww w  .ja  va  2 s  . c om
            return capitalize(manufacturer) + " " + model;
        }
    }

    private static String capitalize(String s) {
        if (s == null || s.length() == 0) {
            return "";
        }
        char first = s.charAt(0);
        if (Character.isUpperCase(first)) {
            return s;
        } else {
            return Character.toUpperCase(first) + s.substring(1);
        }
    }
}

Related

  1. getPhoneModel()
  2. isGoogleTV(final Context context)
  3. isTablet(Context context)
  4. isTablet(Context ctx)
  5. isTablet(final Context context)
  6. getPhoneModel()
  7. convertPhoneType(int type)
  8. getDeviceType(Activity act)