mirror of https://github.com/encounter/SDL.git
Disabled Bluetooth if BLE is not supported
BluetoothManager is supported for Android API 18+. On older versions, skip Bluetooth instead of crashing.
This commit is contained in:
parent
0f0946702d
commit
7032539785
|
@ -7,6 +7,7 @@ import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothManager;
|
import android.bluetooth.BluetoothManager;
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -382,6 +383,11 @@ public class HIDDeviceManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
|
||||||
|
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find bonded bluetooth controllers and create SteamControllers for them
|
// Find bonded bluetooth controllers and create SteamControllers for them
|
||||||
mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE);
|
mBluetoothManager = (BluetoothManager)mContext.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||||
if (mBluetoothManager == null) {
|
if (mBluetoothManager == null) {
|
||||||
|
|
Loading…
Reference in New Issue