#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    How ddms get the name or ID of the device


    Hi, I like to know how ddms get the name or ID of device as shown in the image below? I had tried to find in the settings of the device, but unable to find similar name or ID.

  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2006
    Posts
    529
    Rep Power
    58
    I'm not sure what you mean, but to get the model and manufacturer from code, do the following:


    java Code:
    public String getDeviceName() {
    		  String manufacturer = Build.MANUFACTURER;
    		  String model = Build.MODEL;
    		  if (model.startsWith(manufacturer)) {
    		    return capitalize(model);
    		  } else {
    		    return capitalize(manufacturer) + " " + model;
    		  }
    		}
     
     
    		private 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);
    		  }
    		}

IMN logo majestic logo threadwatch logo seochat tools logo