Android Question getting device name using Settings.Global?

Dave O

Well-Known Member
Licensed User
Longtime User
Hi all,

I'd like to get the name of the user's device (e.g. "Dave's Note 10"), and it's proving harder than I expected.

There's a method using Bluetooth, but I'd prefer not to have to ask for BT permissions just for the device name.

There appears to be a "device_name" in Android's Settings.Global, which I should be able to retrieve using their getString method, but I don't know enough JavaObject to do it. (In particular, I don't understand the contentResolver parameter.)

Any JavaObject tips or other ways to get the device name? Thanks!
 

Dave O

Well-Known Member
Licensed User
Longtime User
Yes, that's why I was looking at alternatives like Settings.Global. Is that "device_name" the same as above, or a different thing?
 
Upvote 0

Dave O

Well-Known Member
Licensed User
Longtime User
Does the Bluetooth method above return the same (unreliable) value, or something better?
 
Upvote 0
Top