I use
BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
in my code to be able to connect with Bluetooth, but unfortunately, this code is already a deprecated method. It still works but I don’t know if it would still be reliable in the future.
So due to this, I tried this code in exchange of the deprecated code above. I use
final BluetoothManager mBluetoothManager = (BluetoothManager) getActivity().getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter bluetooth = mBluetoothManager.getAdapter();
but unfortunately, this code crashes.
Any solutions/alternatives for the deprecated code? Or is it ok to use the deprecated code in future developments?