BT Connected, disconnected, not working

290 views
Skip to first unread message

Serban Vasile

unread,
Mar 5, 2019, 10:21:44 PM3/5/19
to Tasker
BT Connected/Disconnected doesn't work (anymore)

I have two simple complementary profiles, like below. Tasker, as well as APK produced with Tasker, don't register the connected/disconnected BT event. Android 8.1, Verizon, Note 8, Tasker 5.6.
I saw a few similar messages here, with no resolution. This is one of the most used scenarios for Tasker, BT connection driven scenarios. Please fix.

    Profile: BT Connected (83)
        State: BT Connected [ Name:* Address:* ]
    Enter: Car Mode On (74)
        A1: Variable Set [ Name:%CarMode To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A2: Flash [ Text:BT Connected Long:Off ]


    Profile: Not Bt Connected (84)
        State: Not BT Connected [ Name:* Address:* ]
    Enter: Car Mode Off (77)
        A1: Variable Set [ Name:%CarMode To:0 Recurse Variables:Off Do Maths:Off Append:Off ] 
        A2: Flash [ Text:BT Disconnected Long:Off ]

Stefan

unread,
Mar 6, 2019, 7:56:01 AM3/6/19
to Tasker
Does Tasker have access to your location? (in permissions of the Tasker app and also the system settings of Android enabled?).

It might just be that current Android versions require the location permission for Bluetooth to work.

João Dias

unread,
Mar 6, 2019, 9:43:06 AM3/6/19
to tas...@googlegroups.com
What version of Tasker are you using?

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


On Wed, Mar 6, 2019 at 12:56 PM Stefan <s.hoc...@gmail.com> wrote:
Does Tasker have access to your location? (in permissions of the Tasker app and also the system settings of Android enabled?).

It might just be that current Android versions require the location permission for Bluetooth to work.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Serban Vasile

unread,
Mar 17, 2019, 8:03:12 AM3/17/19
to Tasker
Android 8.1, verizon, tasker 5.6

Serban Vasile

unread,
Mar 17, 2019, 8:06:41 AM3/17/19
to Tasker
All permissions are there. Are you telling me your bt connected events are working fine?

Robert Ryan

unread,
Mar 17, 2019, 10:13:29 AM3/17/19
to tas...@googlegroups.com
On March 17, 2019 6:06:45 AM Serban Vasile <serbanv...@gmail.com> wrote:
All permissions are there. Are you telling me your bt connected events are working fine?

The BT Connected state is working correctly on my device.

Samsung S9
Android 9
Tasker 5.7.0-beta.8

What are your Location services set to in the Android system settings? See attached screenshot. 

Screenshot_20190316-110522_Settings.jpg

Serban Vasile

unread,
Mar 17, 2019, 10:12:05 PM3/17/19
to Tasker
I'm on high accuracy, uses GPS,wifi and mobile networks. Blue tooth is not an option. Maybe that is an Android 9 setting. I'm not seeing though why that would matter. It's not the location I'm looking for with this, it's bt connected disconnected.

Serban Vasile

unread,
Mar 17, 2019, 10:40:31 PM3/17/19
to Tasker
I think I figured it out. I added BLUETOOTH_ADMIN to the permissions, when creating the apk, that being a custom permission, not listed among the default. The application seems to be working now. I'll let you know if it's reliable.

Robert Ryan

unread,
Mar 17, 2019, 10:55:31 PM3/17/19
to tas...@googlegroups.com
On March 17, 2019 8:12:12 PM Serban Vasile <serbanv...@gmail.com> wrote:

It's not the location I'm looking for with this, it's bt connected disconnected.

The reason for the question is that Android requires Location be enabled for several of the Net actions. This is a very common issue affecting BT Connected, BT Near, Wifi Connected and Wifi Near.

About 90% of the time problems with these states is caused by Location being disabled. 

Tusko

unread,
Nov 20, 2019, 11:35:49 AM11/20/19
to Tasker
I have the same problem. Tasker has location perms but the "BT connected" state does not work.

Tusko

unread,
Nov 20, 2019, 11:36:44 AM11/20/19
to Tasker
Did you solve the issue?

Robert Ryan

unread,
Nov 20, 2019, 12:01:01 PM11/20/19
to tas...@googlegroups.com
On November 20, 2019 9:35:59 AM Tusko <tus...@gmail.com> wrote:
I have the same problem. Tasker has location perms but the "BT connected" state does not work.

I understand that you have location permissions enabled for Tasker, but that is not all that is needed. You also need to have location enabled in the Android system settings. 
Message has been deleted

Tusko

unread,
Nov 20, 2019, 12:15:01 PM11/20/19
to Tasker
Yes, location is also enabled in Android settings.

Robert Ryan

unread,
Nov 20, 2019, 12:43:09 PM11/20/19
to tas...@googlegroups.com
Please post the exported description (not xml) of the profile. 

On November 20, 2019 10:15:10 AM Tusko <tus...@gmail.com> wrote:

Yes, location is also enabled in Android settings.

-- 
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

Tusko

unread,
Nov 21, 2019, 3:50:16 AM11/21/19
to tas...@googlegroups.com
It is just a test right now. For the record, I also made a test with the BT Connection _event_ and that works. The problem is that I cannot detect disconnects.

--------

    Perfil: BT Connected State (103)
    Estado: Bluetooth conectado [ Nombre:* Dirección:* ]
    Entrada: Anon (104)
    A1: Notificación [ Título:Test BT Connected State Texto: Icono:null Número:0 Permanente:Apagado Prioridad:3 Repeat Alert:Apagado LED Colour:Rojo LED Rate:0 Archivo de sonido: Vibration Pattern: Category: ] 

Stany Freres

unread,
Jan 21, 2020, 5:00:18 AM1/21/20
to Tasker
Hi,

I also had issues with the BT connection event. I found a workaround:
Create two event-based profiles with trigger 'Intent received':
  • One with intent 'android.bluetooth.device.action.ACL_CONNECTED'
  • And a seccond one with intent 'android.bluetooth.device.action.ACL_DISCONNECTED'
Each profile will trigger a task called bluetooth_connected or bluetooth_disconnected
In these tasks, the variable %android_bluetooth_device_extra_device contains the device ID that was connected or disconnected.
Depending on the content of this variable, I use another variable to store the fact that I'm connected or not, for example %CarConnected set to true or false.

Another solution would be to use the Bluetooth autoconnect plugin that works fine according to what I read on other forums: https://play.google.com/store/apps/details?id=org.myklos.btautoconnect&hl=en

Hope it help! 

João Dias

unread,
Jan 21, 2020, 9:23:46 AM1/21/20
to tas...@googlegroups.com
Hhmm, that's strange because in my latest version Tasker also uses those broadcasts! Is it not working for you with the latest Tasker update either?

Stany Freres

unread,
Jan 22, 2020, 3:43:07 AM1/22/20
to Tasker
Hi,

I had the problem with the latest tasker version (5.9.2.beta).
The profile that didn't work was based on BT connected and on Power any (smartphone was charging).

The profile was triggered as expected, but it disconnected randomly. I checked the run logs and the disconnection occured always after the system 'Start monitor' event.
This was really annoying because I had an exit task linked to the profile that would execute when I was still driving.

I don't have this problem anymore since I use the content of the variable.

I hope this information it will help you to identify the root cause...

Regards

Tusko

unread,
Jan 22, 2020, 5:15:26 AM1/22/20
to Tasker
Finally, I solved my issue using an application named "Bluetooth Scanner": https://play.google.com/store/apps/details?id=com.pzolee.bluetoothscanner&hl=en

I used the mentioned app to pair my device "AmazFit Bip smartwatch", then the Tasker's "BT connected" state worked with it.

Note that previously (when I had the reported problem) I could pair the device, but I was pairing it with the default Mi Fit app from Xiaomi. In this case, the connection was not visible to Tasker. 

It is like the Mi Fit pairing was not "public" to other apps (like Tasker), but once I paired the watch using the Bluetooth Scanner app, the watch connection was visible to Tasker.

Hope this helps

João Dias

unread,
Jan 23, 2020, 5:52:26 AM1/23/20
to tas...@googlegroups.com
I don't have this problem anymore since I use the content of the variable.

Hi! Thanks for the report! What content of the variable do you mean exactly? 

Stany Freres

unread,
Jan 24, 2020, 7:48:41 AM1/24/20
to Tasker
Hi, yes sorry, my message was not understandable as is.

I explained this in the first post made on this thread : intents 'android.bluetooth.device.action.ACL_CONNECTED' and 'android.bluetooth.device.action.ACL_DISCONNECTED' were used.
When the ACL_CONNECTED intent was received, then a variable %CarConnected was set to true. When the ACL_DISCONNECTED intent was received the same variable was set to false.

In the profile to check whether I'm connected to the car or not, I use this variable instead of the "BT Connected" state. This works fine since several days now.

Regards

João Dias

unread,
Jan 24, 2020, 9:30:24 AM1/24/20
to tas...@googlegroups.com
Stany Freres can you please use the Report Issue To Developer option and send me a report showing that happnening? Thanks in advance

Stany Freres

unread,
Feb 18, 2020, 5:11:20 AM2/18/20
to Tasker
Hi Joao,

i owe you an apologize for the late reply!

The good news (for you) is that the mistake was on my side. Some details:
When I tried to send report via Tasker (via report issue to Developer), it crashed and didn't send the complete log (only the last 2 minutes).
I checked this page: https://tasker.joaoapps.com/userguide/en/androidpowermanagement.html --> I have a OnePlus 5T and on the dontkillmyapp site, it is mentionned that I should do this: "Go to Recent apps (App switcher). Toggle the Lock button on the upper right corner of the app. "
That's what I did and since then tasker is not killed anymore and the BT Connected state works as expected !!!!

Thus sorry for wasting your time because Tasker works just fine :-)

I hope this can help others --> please always check all the power settings depending on your phone (detailed instructions on dontkillmyapp.com)

Regards,
Stany
Reply all
Reply to author
Forward
0 new messages