Android Question Device Name

Firpas

Active Member
Licensed User
Longtime User
Hi everybody.

My problema is to know the device friendly name.

When you connect via bluetooth, with serial lib, the metod Serial.getPaired returns a map whith devices names as keys.

Well, how can i get this device name in my phone, of course by code.

I Know i can see this name in Setting - About the device.

Thanks ind advance for your cooperation

:-)
 
I think I have not explained well, I need to know is the name of the device where my application is running, and not the surrounding devices.
 
Upvote 0
Please see the attached image
 

Attachments

  • ScreenShot.png
    ScreenShot.png
    82.8 KB · Views: 560
Upvote 0
Yes, I know the library, but in my Samsung Galaxy S4 (Android 4.3) in Settings - More - About device, you can enter a device name as shown in the picture above.

I have also observed that this field is not available on Android 2.x devices you

Is it possible that this field is only available in certain versions of Android such as 4.3 and 4.2?
 
Upvote 0
As far as I know, device name which appears in latest versions of the os, is not the same with the bluetooth device name ( and/or the wifi-direct one). If you want to get the bluetooth friendly name, if this is not supported by the serial lib, you could do it by using the reflection lib.
 
Upvote 0
Changing the device name or any other non-standard features are added by the manufacturer, Samsung does it, HTC does it, etc, so, there's no way to use it all the time since it's manufacturer specific.
 
Upvote 0
Ok, thanks for your answers.
Can you make an example to get the bluetooth friendly name using reflection lib?

Thanks in advance.
 
Upvote 0
You can use this code:
Code: Copy
Dim adapter As JavaObject
adapter.InitializeStatic("android.bluetooth.BluetoothAdapter")
adapter = adapter.RunMethod("getDefaultAdapter", Null)
Log(adapter.RunMethod("getName", Null))

You will need to add the bluetooth permission:
Code: Copy
AddPermission(android.permission.BLUETOOTH)
 
Upvote 0
Back
Top