Dave O Well-Known Member Licensed User Longtime User Dec 24, 2020 #1 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!
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!
Erel B4X founder Staff member Licensed User Longtime User Dec 24, 2020 #2 Code: Copy Dim p As Phone Log(p.GetSettings("device_name")) However it isn't reliable at all. Will not work on many devices. Upvote 0
Code: Copy Dim p As Phone Log(p.GetSettings("device_name")) However it isn't reliable at all. Will not work on many devices.
Dave O Well-Known Member Licensed User Longtime User Dec 24, 2020 #3 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
Yes, that's why I was looking at alternatives like Settings.Global. Is that "device_name" the same as above, or a different thing?
Erel B4X founder Staff member Licensed User Longtime User Dec 24, 2020 #4 Same as above. It is based on Settings.Global. Upvote 0
Dave O Well-Known Member Licensed User Longtime User Dec 25, 2020 #5 Does the Bluetooth method above return the same (unreliable) value, or something better? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 27, 2020 #6 Bluetooth returns a different identifier. It is probably more reliable. Upvote 0