This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository say-my-texts. See https://gitlab.nuiton.org/chorem/say-my-texts.git commit 21bf4601f4bfc043580e2d090f5e47d28e878fab Author: Kevin Morin <morin@codelutin.com> Date: Wed Nov 8 16:54:06 2017 +0100 fix BT connection --- AndroidManifest.xml | 10 ++++++++++ .../java/org/chorem/android/saymytexts/SayMyTextService.java | 10 ---------- .../broadcastreceiver/DeviceConnectionBroadcastReceiver.java | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 9850f8f..1809afc 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -52,6 +52,16 @@ </intent-filter> </receiver> + <receiver android:name=".broadcastreceiver.DeviceConnectionBroadcastReceiver" + android:enabled="true"> + <intent-filter> + <action android:name="android.intent.action.HEADSET_PLUG" /> + <action android:name="android.bluetooth.device.action.ACL_CONNECTED" /> + <action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" /> + <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" /> + </intent-filter> + </receiver> + <receiver android:name=".broadcastreceiver.BootCompletedBroadcastReceiver" android:enabled="true"> <intent-filter> diff --git a/src/main/java/org/chorem/android/saymytexts/SayMyTextService.java b/src/main/java/org/chorem/android/saymytexts/SayMyTextService.java index 162c863..491b53d 100644 --- a/src/main/java/org/chorem/android/saymytexts/SayMyTextService.java +++ b/src/main/java/org/chorem/android/saymytexts/SayMyTextService.java @@ -45,7 +45,6 @@ import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log; import android.widget.Toast; -import org.chorem.android.saymytexts.broadcastreceiver.DeviceConnectionBroadcastReceiver; import org.chorem.android.saymytexts.broadcastreceiver.DictateSmsBroadcastReceiver; import org.chorem.android.saymytexts.broadcastreceiver.SayNextActionBroadcastReceiver; import org.chorem.android.saymytexts.model.Configuration; @@ -116,8 +115,6 @@ public class SayMyTextService extends Service implements TextToSpeech.OnInitList protected boolean headsetPlugged = false; - protected BroadcastReceiver deviceConnectionBroadcastReceiver; - /** * Listener to call state change */ @@ -209,11 +206,6 @@ public class SayMyTextService extends Service implements TextToSpeech.OnInitList updateReadingEnabled(); sharedPref.registerOnSharedPreferenceChangeListener(this); - - deviceConnectionBroadcastReceiver = new DeviceConnectionBroadcastReceiver(); - IntentFilter filter = new IntentFilter(); - filter.addAction(Intent.ACTION_HEADSET_PLUG); - registerReceiver(deviceConnectionBroadcastReceiver, filter); } @Override @@ -225,8 +217,6 @@ public class SayMyTextService extends Service implements TextToSpeech.OnInitList SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); sharedPref.unregisterOnSharedPreferenceChangeListener(this); - - unregisterReceiver(deviceConnectionBroadcastReceiver); } @Override diff --git a/src/main/java/org/chorem/android/saymytexts/broadcastreceiver/DeviceConnectionBroadcastReceiver.java b/src/main/java/org/chorem/android/saymytexts/broadcastreceiver/DeviceConnectionBroadcastReceiver.java index 6bbf78b..eff5a5a 100644 --- a/src/main/java/org/chorem/android/saymytexts/broadcastreceiver/DeviceConnectionBroadcastReceiver.java +++ b/src/main/java/org/chorem/android/saymytexts/broadcastreceiver/DeviceConnectionBroadcastReceiver.java @@ -50,6 +50,7 @@ public class DeviceConnectionBroadcastReceiver extends BroadcastReceiver { if (SayMyTextsApplication.LOG_ENABLED) { Log.d(TAG, "onReceive " + action); } + if (Intent.ACTION_HEADSET_PLUG.equals(action)) { int headSetState = intent.getIntExtra("state", 0); serviceIntent.setAction(SayMyTextService.ACTION_HEADSET_PLUGGED); @@ -72,6 +73,9 @@ public class DeviceConnectionBroadcastReceiver extends BroadcastReceiver { } else { //error recognizing the bt class + if (SayMyTextsApplication.LOG_ENABLED) { + Log.e(TAG, "error recognizing the BT class of the connected device"); + } } } else { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.