Reputation: 896
I am currently creating an Android app that requires using the Android phone's name to store information about the phone. So the name of the phone is always changing. However, the when other phones perform multiple Bluetooth scans, they always seem to only use the first name that was recognized by the phone, even after the phone name has changed. Is there a way to force an Android app to see the new name or flush some kind of cache everything the Bluetooth scan has finished?
Upvotes: 2
Views: 834
Reputation: 896
I just need to manually clear the cache and then make sure to not pair the phones. When the phones aren't paired, the name isn't cached in the phone.
Upvotes: 0
Reputation: 17854
As noted in Howell's answer you can use setName to change the name, and you can use fetchUuuidsWithSdp() to force an update of the name of another phone, but I believe that there is no way for you to force another device to update the service information and name that it has for you.
I guess the best you can do is to simply create a new connection to it and hope that that triggers it to update the info it has on you, but even if that worked it would be implementation dependent (i.e. not reliable), because it has no need to.
Upvotes: 2
Reputation: 35
Did you use android.bluetooth.BluetoothAdapter.setName()
to set the name?
Upvotes: 0