How to fix Bluetooth connectivity issue for Android above 12.

adithya sharma 0 Reputation points
2023-10-26T09:21:25.96+00:00

I have given all the required Bluetooth permissions. My application supports Bluetooth connection with android 11 and below.

Even tried to create context and get the Bluetooth adapter using BluetoothManager.getAdaper(); an it throws error while i call the get adapter function.

Thank you in advance

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Graham McKechnie 416 Reputation points
    2023-10-27T21:22:47.7066667+00:00

    Try the following

    BluetoothManager? manager = Application.Context.GetSystemService(Application.BluetoothService) as BluetoothManager;
    bluetoothAdapter = manager!.Adapter;
    if (bluetoothAdapter == null)
        Toast.MakeText(this, "This device doesn't support Bluetooth.", ToastLength.Long)!.Show();
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.