Sergio
Sergio

Reputation: 30715

Get folder name that appears when the device is connected to a desktop machine using USB Mass Storage or USB Media Device

When Device is connected to the computer the name is displayed as folder of Device (e.g. SAMSUNG_Android) How can I get that name?

Edited: I think we can't get that name. For some devices it is displayed, e.g. for Samsung Galaxy S3, but for others it is not.

Upvotes: 2

Views: 12334

Answers (3)

Sergey Galin
Sergey Galin

Reputation: 446

IIRC the name which appears when you connect Android as a disk is the SD card volume label, at least on the devices with real (non-emulated) SD cards. It can be changed via dosfslabel when connected to Linux. There's no reliable way to read it. I think the best idea is to use Build.MODEL as default and allow user to change it manually in your application.

Upvotes: 0

cjds
cjds

Reputation: 8426

I think what your referring to is how to get the Build Properties of device

http://developer.android.com/reference/android/os/Build.html

Build.PRODUCT is probably what you're looking for. Usually that is displayed on the computer when you connect it.

It gives full Product name

Upvotes: 0

Sam-In-TechValens
Sam-In-TechValens

Reputation: 2519

the below method will help you :

public String getDeviceName() {
  String manufacturer = Build.MANUFACTURER;
  String model = Build.MODEL;
  if (model.startsWith(manufacturer)) {
    return model;
  } else {
    return manufacturer + " " + model;
  }
}

Upvotes: 6

Related Questions