BluetoothDevice.SetAlias(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the locally modifiable name (alias) of the remote Bluetooth device.
[Android.Runtime.Register("setAlias", "(Ljava/lang/String;)I", "", ApiSince=31)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public int SetAlias(string? alias);
[Android.Runtime.Register("setAlias", "(Ljava/lang/String;)I", "", ApiSince=31)]
public int SetAlias(string? alias);
[<Android.Runtime.Register("setAlias", "(Ljava/lang/String;)I", "", ApiSince=31)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.SetAlias : string -> int
[<Android.Runtime.Register("setAlias", "(Ljava/lang/String;)I", "", ApiSince=31)>]
member this.SetAlias : string -> int
Parameters
- alias
- String
is the new locally modifiable name for the remote Bluetooth device which must be the empty string. If null, we clear the alias.
Returns
whether the alias was successfully changed
- Attributes
Remarks
Sets the locally modifiable name (alias) of the remote Bluetooth device. This method overwrites the previously stored alias. The new alias is saved in local storage so that the change is preserved over power cycles.
This method requires the calling app to have the android.Manifest.permission#BLUETOOTH_CONNECT
permission. Additionally, an app must either have the android.Manifest.permission#BLUETOOTH_PRIVILEGED
or be associated with the Companion Device manager (see android.companion.CompanionDeviceManager#associate( AssociationRequest, android.companion.CompanionDeviceManager.Callback, Handler)
)
Java documentation for android.bluetooth.BluetoothDevice.setAlias(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.