alexkendall / react-native-bluetooth-cross-platform

Cross-Platform Bluetooth & WiFi React Native Module. Powered by underdark http://underdark.io/.
179 stars 35 forks source link

fix android simulator crash #45

Closed joshbalfour closed 6 years ago

joshbalfour commented 6 years ago

BluetoothAdapter.getDefaultAdapter() returns null in the android simulator, so calling BluetoothAdapter.getDefaultAdapter().getName() throws an exception.

On initialisation this checks whether BluetoothAdapter.getDefaultAdapter() isn't null and only then tries to run getName()

alexkendall commented 6 years ago

Looks good. Merging