yashsingh1/xdaforums huggingface dataset:
[Tasker Tips & Tricks] Humpie:
My plugin is comparable to the continuous listening mode of AutoVoice, however there is a difference. AutoVoice can continuously listen to what everyone says, convert it to text and then pass that on to Tasker where you can make something happen when a certain word is heard. I did try this before creating this app, but it can be very slow, especially when more words are heard after the hotword you want. AutoVoice will listen until it hears that you stopped talking and then send all it heard to Tasker. It will also often just not get the word correct, so it's not handy to be used as hotword detection.

In comparison, my plugin uses a different engine (not the google speech recognition engine, but Snowboy) which is specifically designed to recognize trained hotwords. So the downside is that you have to train a certain hotword before you can use it, but this does result in a way more accurate detection. It's also way faster as it doesn't have to wait til everyone is silent again and stopped talking, it just instantly triggers after you say the word and signals Tasker.

You can integrate this with AutoVoice if you like, well, more like, let it work together to create something awesome. You can create a task for when a certain hotword is triggered where you stop my plugin from listening, start an AutoVoice prompt where you can say your command (like "set the tv to 10") and then afterwards start my plugin again.
[Tasker Tips & Tricks] Dovidhalevi:
Want to give this a try.

Continuous listening usually leads to too much battery drain.

Is the problem handled in the plugin? Tasker monitors sensors and hardware by intervals which is why it in itself does not eat the battery. Using Tasker's scheme would have (optionally) long waits to test audio when the screen is off.
[Tasker Tips & Tricks] phishfi:
Where is this "voice command" option.

Could you give us an example of your Tasker settings that allow you to use this instead of gAssistant?

I paid, cause I love this idea. Can't wait to try it, but I wholeheartedly support anything better than "OK Google"!
[Tasker Tips & Tricks] Humpie:
It will lead to battery drain, but this is necessary. It would be extremely unreliable if it stopped listening for a while, as in, it would stop working and no longer react to your hotword which defies the entire purpose of the app.
[Tasker Tips & Tricks] Humpie:
"Voice command" can be found under the Tasker actions under the Input tab. Thank you very much :D

I attached an example of how you can launch assistant whilst pausing my plugin from listening for a while so assistant can actually hear you.

You can execute this task for the hotword event you like so "hey google" or "computer" whatever you like and have set up in the hotword plugin
[Tasker Tips & Tricks] Dovidhalevi:
So the question becomes, with any of these things, how I want to use them. Use a Tasker script to toggle the service. For example, if phone is face down, turn it off. Or if I pick up the phone, turn it on. Scripts have "exit" options to reverse the toggle.

I would want to do this with OK Google as well but this plugin offers the option, Google does not.
[Tasker Tips & Tricks] Humpie:
This is indeed possible to achieve with my plugin, however if your phone supports always listening OK Google with screen off already, it usually has a dedicated chip for this that uses very little power. I know my 6P does and leaving OK Google to always listening results in no significant more battery drain
[Tasker Tips & Tricks] QuiXilver777:
So I made a custom hotword model with your website(if I remember right you(Humpie) said it was yours) which I've done flawlessly before, but this time the website worked fine but when I set it up in a profile to trigger my test task that pops up a toast saying "It Works!" it didn't work. So I went to edit the profile trigger and when I went to configure the hotwords that trigger the profile it said that "a hotword selected for this event no longer exists". But nothing changed with the hotword, it's still there and activated in your app.
[Tasker Tips & Tricks] QuiXilver777:
I just deleted the hotword and set it up again in the app and it works fine now, but I thought you might want to know.
[Tasker Tips & Tricks] deechte:
I'm finally on Android 11. Whenever I press Start on the HotwordPlugin notification, I get this error message and hotwords aren't recognized. It works OK if I flip the switch in the app. Any way to make this work?
[Tasker Tips & Tricks] Humpie:
Unless you have root and can make Hotword Plugin a System app, then no. I described more specifics here https://xdaforums.com/t/plugin-hotword-plugin-free.3692422/post-83937513

Google is hammering down hard on background access for all non-system apps.
[Tasker Tips & Tricks] deechte:
Hi, yes I had read that. I understood from it, that it still works if you toggle it from the HWP notification. Which is what I do.
[Tasker Tips & Tricks] Humpie:
In my experience that sometimes works and sometimes doesn't. Not sure what's up with that... Enabling it from the app always works though
[Tasker Tips & Tricks] deechte:
That's a shame. If the notification button would work, I could easily automate pushing it with AutoNotification. Much easier than opening the app and toggling it with AutoInput.
[Tasker Tips & Tricks] deechte:
I've tried making HotwordPlugin a system app, first by using Titanium Backup, but I received an error that there wasn't enough disk space. Retried a few times, but no luck.

Then tried copying the apk to /system)/apps/. Same disk space error.

Last method I tried is with the Magisk module Systemize. I drew the list of available apps with Systemize in Termux, but between approximately 120 apps, Hotwordplugin wasn't there.

I'm really lost on how to make this happen.
[Tasker Tips & Tricks] Humpie:
Systemizer should work in theory. Not sure why Hotword Plugin doesn't show up...
[Tasker Tips & Tricks] deechte:
Is it possible that it is there under another name? Do you have it listed there? It's literally the only one of all my apps that isn't in there.
[Tasker Tips & Tricks] Humpie:
No I don't think so. It should be there. Maybe because I use app bundles instead of apks to publish it on the Play store? In that case you might be able to find an up-to-date apk on a mirror site (since xda labs is down :( ) and try that?
[Tasker Tips & Tricks] deechte:
Both file managers I have on my device (FX explorer and Mixplorer) list HWP as app and can copy its apk to the file system, like with any other app. I don't see any difference in how it is seen or treated.

For now I'm using Tasker and AutoInput to open the app, click on the toggle and close it.

Maybe you could consider building that into the app directly, by using the accessibility service like AutoInput? Another app I use - Bouncer - uses the accessibility service too, to revoke permissions granted to apps temporarily. It doesn't need root. It opens the app's permission menu in Android and revokes permissions in the blink of an eye.
[Tasker Tips & Tricks] Humpie:
I'll keep it in mind. However, running an accessibility service is even heavier on battery than an always running microphone service and usage access (for pre-android 10 devices), so it must definitely be optional.

Keep trying for the system app though, because with root that should be the best solution.
[Tasker Tips & Tricks] deechte:
Isn't everyone using this plugin already heavily invested into Tasker which uses the accessibility service too? Wouldn't that mean it's not that big a difference?

ATM I have no other ideas to make it a system app. Magisk systemize module doesn't show HWP. Copying the apk to /system/app/ isn't possible, even with root. TiBa with root doesn't get the job done either. I'm wondering if it's not an Android 11 prohibition.

BTW, don't you run into problems with OTA updates once you've systemized an app?
[Tasker Tips & Tricks] Humpie:
As long as you use Magisk to systemize an app you're fine. Magisk modules are applied at boot.

Edit: I found out systemizer doesn't work well for converting user installed apps if your data partition is encrypted. All folder names in /data/* are scrambled, so systemizer cannot find the apk. It might still work with a separate apk.
[Tasker Tips & Tricks] deechte:
Isn't the system partition altered by putting the app there? That stays there, right?

I don't know if my data partition is encrypted. It's not a conscious choice I made. What do you mean by "It might still work with a separate apk? I have many user installed apps that are in Systemize's list.
[Tasker Tips & Tricks] Humpie:
Not using systemizer because it uses Magisk which is "systemless" meaning that it doesn't permanently modify the system partition. I'm not sure how it works, but the modules are applied on the unmodified system partition at boot so that some parts of the phone think that the app is now present in the system without actually being there.
[Tasker Tips & Tricks] deechte:
The modules themselves are systemless yes, but the things you can do with them? For instance, Magisk gives you root, but if I understand correctly you can use root to alter partitions that may cause a bootloop after OTA. Hence my question.

I made some addition to my previous post, after you did that to yours:

"I don't know if my data partition is encrypted. It's not a conscious choice I made. What do you mean by "It might still work with a separate apk? I have many user installed apps that are in Systemize's list."
[Tasker Tips & Tricks] Humpie:
Well, yes I suppose you could modify your system partition with root anyways, but that's not the idea of being "systemless".

Well, I just extracted the apk to a file on my /sdcard and I was able to systemize that apk from the terminal using the "systemize" command. So you can try that
[Tasker Tips & Tricks] deechte:
Hi, great, that DOES work! Should I have uninstalled the user-app version of HWP before doing that? I did uninstall it after systemizing the apk ( I figured I would get two versions if I didn't), but now the app won't start. Do I need both versions installed?

BTW, how would I reverse systemizing the app if I would want to?
[Tasker Tips & Tricks] Humpie:
Yes, you should have uninstalled the user app, just to be sure. You can again use the systemize command to un-systemize apps if you like. Let me know how it goes!
[Tasker Tips & Tricks] deechte:
Hi thanks.

I have unsystemized until I didn't have the app anymore. Reboot.

Freshly systemized HWP from apk. Reboot.

Still crashes as soon as I open it from the app drawer. Checked and granted all permissions. Still crashes.

Should I install it as a user app alongside the system app?
[Tasker Tips & Tricks] Humpie:
Try whatever you like! I don't know. It also acts a bit weird for me. For instance, after stopping, the notification goes away.

Unfortunately I don't have time to delve in deep since I'm working on my masters thesis at the moment.
[Tasker Tips & Tricks] deechte:
I've tried installing it as user app alongside a system app, installing it to /system/priv apps/ instead of /system/apps/, but nothing helps. HWP always stops immediately before showing any screen. After the second try, Android gives the "app keeps stopping" dialogue.

For now I'll use it as normal user app and automate turning it on with AutoInput. I hope you find time to make things better in the future.
[Tasker Tips & Tricks] deechte:
Hi @Humpie after all of my testing, I can't get HWP to work any more. I did a regular install from the Play Store, imported my hotwords back in again. Tasker complained about not finding the hotwords anymore in the Event dialogue, so I had to re-select them one by one, which was successful.

However, each time I say a hotword, I hear a bling sound from my phone, but nothing happens. My task isn't fired. The Tasker log shows no trace of anything happening.

It's as if HWP and Tasker are disconnected. I know something is happening because of the bling sound after saying each of my hotwords. Created a new Event profile with one of my hotwords, but no task gets fired either.
[Tasker Tips & Tricks] Humpie:
I don't know man... Maybe all this fiddling has had its consequences. I'd recommend just starting anew with hotword plugin and all the tasks/profiles. Might be a bug with the app, but I have no way to recreate the situation you currently have to test and fix it.
[Tasker Tips & Tricks] deechte:
OK thanks. I'll try clearing cache and data and do a fresh install.
[Tasker Tips & Tricks] deechte:
OK, so I did this:

And then I did this:

But it still doesn't work. I hear a bleep, so HWP recognizes my hotword, but there's no connection to Tasker. Is there a log I can check somewhere from HWP?
[Tasker Tips & Tricks] Humpie:
I don't know, might be Tasker then. There are no logs turned on by default unless the app crashes, so no. Again I'm too busy right now to figure it out with you together unfortunately, so you're on your own. For me the plugin has always functioned fine using a clean install and new Tasker profiles/tasks. Just make sure to disable any battery saving features for both apps to be sure.
[Tasker Tips & Tricks] deechte:
Hi, yes battery saving settings were something I checked already. I give up then. Really sad.
[Tasker Tips & Tricks] deechte:
Some advise from the Tasker subreddit

https://www.reddit.com/r/tasker/comments/miurdl/_/gt8gtec
Ask the dev to give the app SYSTEM_ALERT_WINDOW permission, this will allow it to operate in the background; which is likely a cause (in newer Android, apps are limited what they can do in background).
[Tasker Tips & Tricks] Humpie:
Put it on my to do list, but again, don't have time atm. Thanks for letting me know
[Tasker Tips & Tricks] deechte:
Just a FYI, I've found a workaround. I can use an event profile that listens to what HotwordPlugin produces in the logcat.

So I'm back in business again.
[Tasker Tips & Tricks] rophiroth:
App is totally not working on oxygenos 11. Any noise activate the plugging x, x
[Tasker Tips & Tricks] Humpie:
You need better trained hotwords for that. Here are some examples of well trained ones: https://github.com/seasalt-ai/snowboy/tree/master/resources/models

If you use my website snowboy.jolanrensen.nl, you also need a LOT of samples, about a hundred to make it work better. After that the settings of Hotword plugin also need to be set well :)
[Tasker Tips & Tricks] rophiroth:
hundred! D: wow.. and what settings must be setted? Do you already post all of this info and i didnt see in main post? @,@ thank you
[Tasker Tips & Tricks] Humpie:
Well there is the audio gain and audio source setting in the app settings of Hotword plugin. Audio gain might need to be tweaked to get it to work better, because no microphone is the same.

And the sensitivity of the hotwords you use also can be changed, so it's a bit of trial and error.

And yes, a hundred is even a small amount. The original Snowboy website had a lot of hotwords with already up to 2000 samples. Those worked really well (and a number of them can still be found at the GitHub link I sent before). Then if you needed the hotword for the app you could say it 3 times and it would be trained for your voice specifically.

Unfortunately this website does not exist anymore :( so you will need to provide all the samples yourself.
[Tasker Tips & Tricks] Dreamcatcher0664:
Hi, I think, I have the same problem. I had not used the hotword plugin for some time and now I found out I only hear the pling but nothing get's triggered in Tasker. Can you send a copy of your workaround profile? I cannot figure out how to check the logcat. (Sorry, I still haven't left the beginner state yet.)
[Tasker Tips & Tricks] deechte:
Have you ever tried logcat events in profiles? If not, play around with that first and read the help section on that.

Here's my export for my HWP profile called OK_google-1. The bold texts are what goes into the event profile, but it depends on the name in HWP.

Profile: Logcat HotwordPlugin OK_google-1 used as hotword

Settings: Restore: no

Event: Logcat Entry [ Output Variables:* Component:hotwordPlugin Filter:Hotword OK_Google-1 detected! Grep Filter (Check Help):Off ]

Enter Task: OpenGoogleAssistant

A1: Music Play [

File: Ringtones/open_mp3.mp3

Start: 0

Stream: 5

Continue Task Immediately: On Continue Task After Error:On ]

A2: Flash [

Text: Hey/Ok Google called

Long: On ]

A3: Launch App [

Package/App Name: Assistant ]
[Tasker Tips & Tricks] Dreamcatcher0664:
Thanks for your reply.

I haven't tried anything before where I have to grant special permissions via ADB. And I'm not sure I will try now. But I'll keep it in mind.

For me the Hotword detection is not so important. Sometimes it can be quite annoying, when your phone tries to join a conversation with your kids ;). Then it seems to react to any word it likes not only the hotword.

Have a nice weekend!
[Tasker Tips & Tricks] Humpie:
It's been a long while since I worked on the app. I finally managed to get it to build again after two full days (targeting android 12 is not yet even possible), but it seems the entire Tasker support has changed in the meantime. I have to convert everything to this https://tasker.joaoapps.com/pluginslibrary.html new system, so it will take a while. This does explain why the plugin stopped working for a lot of you. When the next version releases, it will probably be a Beta and a bit buggy (sooo many changes are needed), but I am still continuing the work :).
[Tasker Tips & Tricks] deechte:
Very happy to hear from you Humpie!
[Tasker Tips & Tricks] Humpie:
Hi y'all, it's beta time!

It's been a long time and a couple of days work, but I believe everything is working again. I'm not completely confident yet due to the sheer amount of changes, but that's where you come it. I've released the beta for version 4.0 on Google Play (waiting for review) and here in the post if you want.

4.0beta01:

Rebuilt Tasker communication completely (It should be a lot more stable, but you need to set up all your tasks again unfortunately :( )

Android 12 ready

Material You theme support!

New hotword training website linked

before:

New Tasker action to change app settings!

Figured out on Android 11 the service can only be started from the app or notification :(
[Tasker Tips & Tricks] deechte:
Hi Humpie,

What you write in the last paragraph still applies, or it doesn't anymore? I mean, is it possible to turn HWP mic access on again on Android 11 from within Tasker?
[Tasker Tips & Tricks] Humpie:
Yup that's still the same. Android 11+ doesn't allow the microphone to be started from the background right? I haven't looked into adb/root solutions yet though (making the app work normally again was my main priority)
[Tasker Tips & Tricks] deechte:
Ah right. I was hoping that you found a solution for that. The other problems I worked around already with the logcat route.
[Tasker Tips & Tricks] Humpie:
The logcat way is no longer necessary luckily! I couldn't have a Tasker plugin that couldn't communicate with Tasker anymore, now could I? It might also be faster and more reliable now than it ever was, since I now use the official Tasker plugin library (which didn't exist before)
[Tasker Tips & Tricks] deechte:
You're completely right about that!
[Tasker Tips & Tricks] Humpie:
This doesn't work btw, nor does android.permission.START_ACTIVITIES_FROM_BACKGROUND, since I cannot grant the app this permission. I also tried to make it a system app, but that breaks the native Snowboy part, so that still doesn't work. There might be a way, but it's very difficult and I'm not sure how I could do that. I think your best bet is to keep the service enabled manually by opening the app and solve the enabling/disabling using if statements in your tasks.

Accessibility is still an option, but mis-using that will get the app banned from the play store :(
[Tasker Tips & Tricks] deechte:
Thanks for looking into it.

How you describe it is more or less how I'm doing it: clicking the HWP interface with AutoInput.

Maybe an idea is to create a seperate helper app that you distribute separately that does just the accessibility stuff? Tasker also has a separate non-play store helper app that allows toggling Wi-Fi cause Google doesn't allow for it.
[Tasker Tips & Tricks] Humpie:
That's what I'm currently looking into. Not sure if it's possible yet (haven't had success with a helper app being a system app, but accessibility I'll try next), since the hotword plugin app itself must be a normal app to be allowed on the play store. And of course I don't feel like keeping another version up to date all the time (I already have the free and paid one), but I'll keep you up to date
[Tasker Tips & Tricks] deechte:
The way I understand it is that the helper app is as light as possible, does just the one thing Google doesn't allow. The less it does, the less maintenance it takes. Everything else is in the main app. But don't make the mistake to put any kind of link or suggestion in the app or in the PS description about the helper add-on. .
[Tasker Tips & Tricks] Humpie:
Yes, but the problem is that the main app needs to have the listening service on the background. I can't take that out of the app and put in in a helper because it's such a big part of the app itself.

My current tactic is trying to start the listening service from the helper, but all my attempts still keep the microphone disabled. I've tried making the app itself a system app, making the helper a system app and making the helper an accessibility service, but still none can activate the listening service with mic on the background of the main app...
[Tasker Tips & Tricks] deechte:
Hi Humpie, I've only just found out this 4.0 beta doesn't come through the Play Store. Silly me.

Before I install the apk from your post, I'd like to know how to back up my current hotwords. You see I once "lost" a good working hotword when changing phones, it worked very rarely afterwards and I couldn't remake or retrain it cause snowboy was gone. Do I need to backup files in

/storage/emulated/0/Android/data/nl.jolanrensen.hotwordPlugin/files/hotwords

Or in

/storage/emulated/0/hotwordPlugin

Both locations contain more or less the same.pmdl files but their sizes differ.

And as for restoring: just place them in one of those folders, or recreate them in HWP importing pmdl files? Will the latter put the files in one of those folders?

BTW, am I the only beta tester?
[Tasker Tips & Tricks] Humpie:
The one in /Android/data is the new folder as apps are losing the right to create their own folder now. So you can simply copy those and store them somewhere safe, before importing them again through the hotword plugin app.

I'm not sure how many people are running the beta. I haven't looked at my apps in a while, but I'm graduating this month so afterwards I'll finish the update and release it to the stable channel! It's been long overdue
[Tasker Tips & Tricks] deechte:
Thanks Humpie, I'll give it a go.
[Tasker Tips & Tricks] deechte:
So far v4.0beta01 works good on my Android 11 device. Hotwords are detected. The core functionality works great.

I tried deleting a hotword from the list. At first try nothing happened, it wasn't removed. At second try, all hotwords in the list were gone at once.

I then reimported my existing hotwords. The were all given a higher number than before. I then found out the old pmdl files were still in the /android/data/ folder, so I guess that's why they received a higher number. If you ask me, removing them from the list should remove the files or move them to a backup location.

I used the download button to go to snowboy.jolanrensen.nl and make a new hotword. When I was at 40ish consecutive tries, the site showed a button to ask for microphone permission (again), which it already had. All my iterations were gone. I tried again, but saved it after 25 iterations, and it works fine.

I did not use the Tasker integration part yet, cause my setup is centered around listening the logcat for when HotwordPlugin produces something there.