Sent SMS as trigger

660 views
Skip to first unread message

legaldeejay

unread,
Feb 5, 2023, 8:56:11 PM2/5/23
to Tasker
Hello, I am trying to figure out how to trigger an action by sending a text message externally and not from Tasker itself.   I have tried Logcat and an old app called HippoSMSTrigger without success.  Using Android 13.  Any ideas?  Thanks. 
Message has been deleted

Soudane GMTA

unread,
Feb 6, 2023, 12:07:29 AM2/6/23
to Tasker

It turns out that I was posting back in 2014 under the handle "Hippo Man", and I'm the one who wrote HippoSMSTrigger back then!

I still have the APK for the latest version that I wrote, and perhaps it might be newer than the latest version that I posted in 2014.

I havent used that utility in more than 8 years, but I installed it just now on my Android-11 device (crDroid-v7.25), and I'm pleasantly surprised that it  it actually works!  ...  because I originally developed it to run under kitkat, and lots of things have changed in Android since that version.

It might not work on Android 12 or Android 13, but here's my Dropbox link for it, just in case it's newer than the version you currently have, and just in case it might actually work for you.  It's version 2.0.0.

HippoSMSTrigger.apk

To run it, install the APK, launch it, and tell it to start the service.

Then, set up an Event Received context in Tasker and match on the following action:
us.potam.hippo.SMS_SENT

The following variables will be available in the receiving task ...
%sms_from -- sender
%sms_to -- recipient
%sms_date -- date/time stamp of the SMS
%sms_body -- the body of the SMS

On my device, Tasker sees the intent around 10 seconds after the SMS message is sent.

If it doesn't work, I'm very sorry that I can't help any further, because I no longer have the source code for this app. It was just an experimental hack that I didn't have time to support back in 2014, and I got rid of the source code a few months after I originally wrote it.

But I hope this might actually work for you!

Soudane GMTA

unread,
Feb 6, 2023, 12:48:48 AM2/6/23
to Tasker

And good news!  I actually found the source code for HippoSMSTrigger!  It's now in a file called ExperimentalSMSTrigger.tgz in the same dropbox folder that I mentioned above.

I don't have time to work on this code at all, but if the APK doesn't run under Android 13 and anyone wants to get the code running and perhaps enhance it, feel free to do so.

Matevz Leskovsek

unread,
Feb 6, 2023, 4:49:46 AM2/6/23
to tas...@googlegroups.com, gmta.s...@gmail.com
Nice! Thanks for sharing!
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/94b6f937-dc9c-4996-97ac-fa1b10487500n%40googlegroups.com.

Matevz Leskovsek

unread,
Feb 6, 2023, 4:53:16 AM2/6/23
to tas...@googlegroups.com
btw OP from legaldj was also marked as spam.. I am regularly
searchinjg my spam and whitelisting this list and few others..

legaldeejay

unread,
Feb 6, 2023, 8:08:18 AM2/6/23
to Tasker
Thanks for sharing.  I will test it and let you know. The version I have sometimes works but it seems the service stops running. 

legaldeejay

unread,
Feb 6, 2023, 8:38:02 AM2/6/23
to Tasker
Just tested it and it works inconsistently like the version I already have.  If I can figure out another method, I will post. Thanks again.   If anyone comes up with anything else, please post. 

Soudane GMTA

unread,
Feb 6, 2023, 9:49:00 AM2/6/23
to Tasker
Oh, I'm very sorry that it doesn't run consistently. Either there are bugs in the code, or else this has something to do with the way that newer versions of Android manage the running of apps and services.

In either case, maybe someone might be willing to dive into the source code that I published and perhaps figure out how to make it work properly. As I mentioned, I unfortunately don't have time to do that myself for the time being. If some time in the future I am less busy, I'll get back to this and see if I can make it work.

Good luck finding a solution for this!

legaldeejay

unread,
Feb 6, 2023, 10:41:33 AM2/6/23
to Tasker
OK thank you .   I am surprised Tasker's features do not include monitoring external SMS messages.  I use Google Assistant to compose and send hands-free text messages while in the car.   But Google Assistant will not close after the message is sent.  I am trying to trigger a Back button action in Tasker which will close Google Assistant after the message is sent.   I have tried using Autoinput State to capture text from Google Assistant but that doesn't work either.  Perhaps I am going about this the wrong way.   If you have another other suggestions, please post.

Soudane GMTA

unread,
Feb 6, 2023, 10:56:13 AM2/6/23
to Tasker
In order to track outgoing SMS messages, a "ContentObserver" service needs to be installed on the device. My HippoSMSTrigger app implements such a service.

Maybe some day Tasker would include the installation of this kind of "ContentObserver" service. The HippoSMSTrigger source code provides this basic functionality already, so not much new code would need to be written ... just fixes for the consistency problems.


legaldeejay

unread,
Feb 8, 2023, 10:41:57 PM2/8/23
to Tasker
I am pleased to report that I got HippoSMSTrigger to work in Android 13.  I had to change the battery setting for the app from optimized to unrestricted.  Now it works consistently.   Thanks again for the app. 

Soudane GMTA

unread,
Feb 8, 2023, 11:03:52 PM2/8/23
to Tasker
OMG!  That's great!

A day or two ago, I quickly tried to import the source code into today's Android SDK to try to get it to compile. But there were numerous kitkat-level conventions in use in the more-than-8-years-old code, and I couldn't even get it to compile. Given my lack of available time, I gave up soon after starting.

I'm very glad to know that the ancient code still works and that no upgrading of the module will be needed ... at least so far.

Thank you for letting us know!

Soudane GMTA

unread,
Feb 8, 2023, 11:41:52 PM2/8/23
to Tasker
PS: On my Android-11 device, HippoSMSTrigger starts up at boot time, but the service doesn't automatically start. It won't run until the app is launched and the Start the HippoSMSTrigger Service button is clicked.

That can be automated by invoking a Tasker task in a Device Boot profile that launches HippoSMSTrigger and then uses AutoInput to click on that button

legaldeejay

unread,
Feb 9, 2023, 12:10:17 AM2/9/23
to Tasker
Ugh so I thought I got it working but it stopped again.  Seems to get working again when just opening the app even though the service is running which is odd.  Then after a while it stops working.  Oh well back to the drawing board. 

Soudane GMTA

unread,
Feb 9, 2023, 9:16:57 AM2/9/23
to Tasker
Oh no!

Over time, I'll see if I can come up with a newer way of doing this. And if you come up with anything, please let me know.

legaldeejay

unread,
Feb 9, 2023, 12:50:52 PM2/9/23
to Tasker
OK thanks. 

Soudane GMTA

unread,
Feb 14, 2023, 11:49:42 PM2/14/23
to Tasker
Follow-up ...

I have done some investigation, and it turns out that newer versions of Android (starting with something like Android 11, I think) will always eventually kill background services. This original kitkat-based service runs via such a background service, and that's why it doesn't run forever for you under Android 13. However, these newer Android versions now offer something called a Foreground Service , which will run permanently.

In order for Foreground Service to actually run forever, it requires a permanent notification to be present, and it also requires the user to give it a special FOREGROUND_SERVICE permission, which should be requested when the app is installed. After granting that permission upon app installation, no more interaction with the service should be necessary in order for it to be triggered by outgoing SMS messages ... as long as the permanent notification is not deleted.

In my barely existing spare time, I'm very slowly working on a newer version of this app which will make use of a Foreground Service. Realistically, it probably won't be ready for a few weeks, I'm sorry to say.

But whenever I get it done, I'll let you know, so you can try it.

In the mean time, if someone is ambitious and has more spare time than I do, they can feel free go to the dropbox link that I supplied above and get the source code for the original kit-kat based app, and then convert it to run with a Foreground Service under later versions of Android. That might result in a functioning app being ready before I will be able to finish my own work on it.

Don Fiordelisi

unread,
Aug 29, 2023, 4:09:44 PM8/29/23
to Tasker
Hello,

I have been following this thread for some time. I have gotten the existing trigger to work but on the version of Android I am using, ver. 12, it does not remain active. I have worked on not optimizing this app but that does not seem to work to keep it from shutting down.

I saw that gmat*@gmail.com indicated that they would be updating the app back on Feb 14th, 2023. I was wondering if this has been completed and where it can be downloaded.

Thank you very much for your help.

Soudane GMTA

unread,
Aug 29, 2023, 6:58:03 PM8/29/23
to Tasker
I'm sorry, but I never was able to get this working properly under Android 11, and I haven't been able to even try under any later Android version.

This doesn't mean that it's impossible to get it to work. It might indeed be possible, but because of issues in my life, I haven't been able to do any more work on this particular task for the past several months. I don't know when I might be able to resume that work.

Again, I'm very sorry!!!!!!

Soudane GMTA

unread,
Aug 30, 2023, 1:43:48 PM8/30/23
to Tasker
Although my special SMS trigger app sadly isn't an option, and although you said that logcat didn't work for you, I indeed figured out a way to do this using logcat.  This may not work on all OS's, devices, or SMS programs, but it works for me under crDroid 7.28 (Android 11) on a Pixel 5, and with the Textra SMS program.

I set up Textra to be ready to send an SMS. All that remained was to click the send button.

I then went to Tasker and set up a Logcat Entry context by using the magnifying glass button associated with the "Component".

I then went back to Textra, where the ready-to-send SMS was waiting.

And I then clicked the bubble created by logcat, immediately hit the SMS Send button, and immediately re-clicked on the bubble.

One of the logcat entries which were returned was the following, where [CONTACT] was the name of the SMS contact to whom I sent the message, where [PHNUMBER] was the phone number associated with that contact, and where [SMSTEXT] was the text of the message that I sent ...

sms: androidx.work-2    : SmsMgr@c86d7c7: send queueId 148: sending SMS to: dc3@67cce5d[1338,null,[CONTACT],[PHNUMBER],US,checksum=18677853,pic=null] of 1 segments, content://mplus/148_1693416620620_0_0 to content://mplus/148_1693416620620_0_0 (with delivery receipts). First segment=[SMSTEXT]

I could then parse out the [CONTACT], [PHNUMBER], and [SMSTEXT] from within this context's Entry task.

I don't know whether such a logcat message would get logged if I used something other than Textra, or if I was on a different device or using a different OS.

But at least such a thing is a possibility.

Matevz Leskovsek

unread,
Aug 30, 2023, 1:57:38 PM8/30/23
to tas...@googlegroups.com
Outgoing calls and SMS messages became somehow more secure with
android after version 6. Incoming calls and SMS were easily processed,
but outgoing texts not (calls worked on 8.1 if i remember correctly).
Monitoring notification with autonotification should bypass this
limitation, I believe.

Hope any of this helps, I really never got so much into it as you guys
in this email thread
> To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/78f5664f-76d3-4dc2-b074-ab0b1d122dabn%40googlegroups.com.

Soudane GMTA

unread,
Aug 30, 2023, 2:15:49 PM8/30/23
to Tasker
Clarification:

All that specifically has to be set in the Logcat Entry "Filter" field for my example above is ...

~R.*Txtr:sms:.*

And the "Component" field should be empty.

And "Grep Filter" should not be selected.

Then, the Entry task just has to parse the %lc_text variable to get the contact, phone number, and message text.

Matevz Leskovsek

unread,
Aug 30, 2023, 2:19:23 PM8/30/23
to tas...@googlegroups.com
Cool! Btw there is a reddit thread with logcat profiles, and this
should be added. Also could be added to taskernet.. good work!
> To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/0e7cc468-5278-4133-9291-62340a76ada3n%40googlegroups.com.

Soudane GMTA

unread,
Aug 30, 2023, 2:20:25 PM8/30/23
to Tasker
Notification capture only works if the SMS program sends the recipient info and the outgoing message text in notifications.

The SMS programs I tested with (including the Textra program which I used in my example above), do not send out that information in any notifications when outgoing messages are sent.

However, I  wouldn't be surprised if there are indeed one or more SMS apps which do allow that info to be contained in notifications when messages are sent.


On Wednesday, August 30, 2023 at 1:57:38 PM UTC-4 matevz.l...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages