[say-my-texts] 01/01: fixes #1056 Error when a bluetooth device connects
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository say-my-texts. See http://git.chorem.org/say-my-texts.git commit bcab8a04b20c10c6138b8511c0bf66ee714ee4f8 Author: Kevin Morin <morin@codelutin.com> Date: Thu Aug 21 23:36:25 2014 +0200 fixes #1056 Error when a bluetooth device connects --- .../android/saymytexts/NewTextBroadcastReceiver.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/org/chorem/android/saymytexts/NewTextBroadcastReceiver.java b/src/org/chorem/android/saymytexts/NewTextBroadcastReceiver.java index 908c97f..5dd1eb6 100644 --- a/src/org/chorem/android/saymytexts/NewTextBroadcastReceiver.java +++ b/src/org/chorem/android/saymytexts/NewTextBroadcastReceiver.java @@ -99,11 +99,17 @@ public class NewTextBroadcastReceiver extends BroadcastReceiver { serviceIntent.setAction(SayMyTextService.ACTION_MANAGE_BT_DEVICE); if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) { - int majorDeviceClass = device.getBluetoothClass().getMajorDeviceClass(); - if (majorDeviceClass == BluetoothClass.Device.Major.AUDIO_VIDEO) { - serviceIntent.putExtra(SayMyTextService.INTENT_EXTRA_BT_DEVICE, device); - serviceIntent.putExtra(SayMyTextService.INTENT_EXTRA_ADD_BT_DEVICE, true); - context.startService(serviceIntent); + BluetoothClass bluetoothClass = device.getBluetoothClass(); + if (bluetoothClass != null) { + int majorDeviceClass = bluetoothClass.getMajorDeviceClass(); + if (majorDeviceClass == BluetoothClass.Device.Major.AUDIO_VIDEO) { + serviceIntent.putExtra(SayMyTextService.INTENT_EXTRA_BT_DEVICE, device); + serviceIntent.putExtra(SayMyTextService.INTENT_EXTRA_ADD_BT_DEVICE, true); + context.startService(serviceIntent); + } + + } else { + //error recognizing the bt class } } else { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm