Search code examples
androiddeviceapplication-settings

How to fetch Device Name (NOT Build.MODEL) from Android programatically?


I have been searching for code through which I can fetch Device's name defined by user for his own device . Have gone through various stackoverflow questions , but none seems to work for me ?

Image as seen in below : Will require Thanks Thanks (SM-T211 ) from android code

enter image description here


Solution

  • Try this:

    String ownerInfo = Settings.Secure.getString(getContentResolver(),
        "lock_screen_owner_info");
    

    As of Android 4.4.2 the owner info value is moved to lock screen database,/data/system/locksettings.db to which 3rd-party apps have no read/write access. That's, there is no reliable way of reading owner info for later Android versions except for rooted device.