Android : Get “device name” on android tv

前端 未结 1 1963
离开以前
离开以前 2020-12-04 03:13

I know this question is something that is often asked but no matter what I tried I couldn\'t find the answer.

I use an AVD android TV (API 24) and want to access thi

1条回答
  •  渐次进展
    2020-12-04 03:43

    this is worked for my AVD (API level 24).

    String deviceName = Settings.Global.getString(getContentResolver(), "device_name");
    

    Instead of the string "device_name", you can also use the constant Settings.Global.DEVICE_NAME.


    This property was moved into Settings.Global in API 17.

    Before API 17, the following code should work:

    String deviceName = Settings.System.getString(getContentResolver(), "device_name");
    

    0 讨论(0)
提交回复
热议问题