Delete/Mark as read for texts

278 views
Skip to first unread message

Heather

unread,
Jun 2, 2014, 4:45:43 PM6/2/14
to tas...@googlegroups.com
I want to preface this by saying that I don't know anything about SQL, Python, or any other Android programming so please be patient!

Goal: to have the notification for a new text give the options to delete the message or mark it as read.

Where I'm stuck: the tasks to delete/mark read. I've got the AutoNotification working fine so far, so that's not a problem.

I've found on the forums a way to do it with SQLite3 (https://groups.google.com/forum/m/#!topic/tasker/kn9r4I2CPQ8/discussion), however it doesn't work. I believe it's because I'm not able to install SQLite3. I have an HTC One M8 and I have the WeakSauce root, which does not give me write access to the system folder (except xbin). I love that the root is so non-invasive as I didn't want to root to begin with. I do not want to do the whole S-Off thing for that reason.

I was able to copy SQLite3 to the xbin folder as I saw that it either needed to be there or the bin folder. I assume it does need the bin folder because it's not working.

Anyway, I also tried to do this via SL4A (http://taskerfans.blogspot.com/2013/04/sl4a-python-script-to-manage-android.html?m=1), but no success there. I honestly don't know why this one isn't working as I feel that it may be my best option.

So, any thoughts on how to go about this with my situation?

Thanks!

nanobrain

unread,
Jun 2, 2014, 5:38:14 PM6/2/14
to tas...@googlegroups.com
The actual folder should not matter. When you call the sqlite3 binary do you specify the complete path e.g. /xbin/sqlite3. xbin is probably not in your PATH android searches to find its commands. Try that.

Also worthwhile doing is to get a terminal emulator and try the command from the command line. That at least can give you informative error messages.

Good luck

Heather

unread,
Jun 2, 2014, 5:51:29 PM6/2/14
to tas...@googlegroups.com
Thanks for your reply!

In the RunShell, I tried both this:
/xbin/sqlite3 /data/data/com.android.providers.telephony/databases/mmssms.db "DELETE from sms where address='%SMSRF' and body like '%SMSRB';"

And this:

qlite3 /data/data/com.android.providers.telephony/databases/mmssms.db "begin transaction; DROP TRIGGER sms_words_delete; DELETE from sms where address='%SMSRF' and body ='%SMSRB'; CREATE TRIGGER sms_words_delete AFTER DELETE ON sms BEGIN DELETE FROM words WHERE source_id = OLD._id AND table_to_use = 1; END; commit;"


Neither work. Am I doing something wrong?

nanobrain

unread,
Jun 2, 2014, 6:13:40 PM6/2/14
to tas...@googlegroups.com
In the Run Shell action put a variable name (e.g. %error) in the "Store Errors In" field, followed by a Alert> Flash %error action. What does it show in either case? 

Heather

unread,
Jun 2, 2014, 6:39:36 PM6/2/14
to tas...@googlegroups.com

Both times it comes up and says tmp-mksh: <stdin>[2]: /xbin/sqlite3: not found

I don't understand why it's not found because I ran the SQLite Installer for Root and since it failed (I assume it was trying to put it into the bin instead of xbin) I manually moved it to xbin. So it's there! I even just rechecked it to make sure it didn't delete somehow and it is 100% in system/xbin.

Heather

unread,
Jun 2, 2014, 6:42:56 PM6/2/14
to tas...@googlegroups.com
I just added /system in front of /xbin and now it says can't execute: Permission denied. Ugh, that makes no sense. Obviously I should have permission, otherwise how did I move sqlite3 to /system/xbin/? I double checked that I do still have root access, too, so I'm really lost.
 

On Monday, June 2, 2014 6:13:40 PM UTC-4, nanobrain wrote:

Matt R

unread,
Jun 2, 2014, 6:48:09 PM6/2/14
to tas...@googlegroups.com
You could try chmod 0755 /system/xbin/sqlite3

Matt

Heather

unread,
Jun 2, 2014, 6:55:05 PM6/2/14
to tas...@googlegroups.com
Thanks Matt!
 
I think we're making progress. Now I'm getting this error for each one: Unable to open (everything in quotes, with the variables replaced): No such file or directory
 
So it looks like the SQLite3 is finally working, but it's not coded right?

Matt R

unread,
Jun 2, 2014, 7:38:00 PM6/2/14
to tas...@googlegroups.com
Try using the ls command to see what's in each folder to confirm the file name.  That is, first ls /data/data/com.android.providers.telephony/databases to see what files are in that directory.  If it says it can't find the /.../databases directory, then try ls /data/data/com.android.providers.telephony, etc.

Matt

Heather

unread,
Jun 2, 2014, 9:16:42 PM6/2/14
to tas...@googlegroups.com
So I used Android Terminal and when I did ls /data/data/com.android.providers.telephony/databases I got:
cdmaapn.db
cdmaapn.db-journal
mmssms.db
mmssms.db-journal
telephony.db
telephony.db-journal
 
So mmssms.db is there. Why won't it read it?

Heather

unread,
Jun 2, 2014, 9:21:53 PM6/2/14
to tas...@googlegroups.com
Alright, in the terminal I just did:
/system/xbin/sqlite3 /data/data/com.android.providers.telephony/databases/mmssms.db "DELETE from sms where address='phonenumber' and body like 'body';"
 
And it worked. So why isn't it working in the Tasker RunShell?

Matt R

unread,
Jun 2, 2014, 10:05:15 PM6/2/14
to tas...@googlegroups.com
Can you export the description of your tasker task? Long-press the task name and select menu -> export -> description to clipboard and paste in a reply here.

Matt

Heather

unread,
Jun 2, 2014, 10:49:36 PM6/2/14
to tas...@googlegroups.com
Yup. You can ignore the context since I keep running the task manually to test.

Profile: Delete Sms (94)
Event: AutoNotification [ Configuration:Event Behaviour
Filter: deletesms ]
Enter: deletesms (85)
A1: Run Shell [ Command:chmod 0755 /system/xbin/sqlite3 /data/data/com.android.providers.telephony/databases/mmssms.db "DELETE from sms where address='%SMSRF' and body like '%SMSRB';" Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In:%errorsms Store Result In: Continue Task After Error:On ]

Matt R

unread,
Jun 2, 2014, 10:59:28 PM6/2/14
to tas...@googlegroups.com
You only need to chmod once. This changes the permissions on the sqlite executable. Try removing that part.

Matt

Matt R

unread,
Jun 2, 2014, 11:09:58 PM6/2/14
to tas...@googlegroups.com
Also, you'll want to be careful when %SMSRB gets replaced because if it contains a single- or double-quote it will screw up your command. You should probably do a variable search replace action to change any quotes to underscores (a wildcard meaning any one character). Then you'll also have to change the equal sign to LIKE.

Matt

Heather

unread,
Jun 2, 2014, 11:19:18 PM6/2/14
to tas...@googlegroups.com
I took the chmod 0755 out and it's still not working through the Run Shell task. =(  I checked for an error and there were no errors. It just flashed with the variable I used for the error.
 
Also, thanks for letting me know about the possible quote issue! I will absolutely change that variable.

Matt R

unread,
Jun 3, 2014, 12:06:38 AM6/3/14
to tas...@googlegroups.com
What if you use fixed phone number and body instead of variables?

Matt

Heather

unread,
Jun 3, 2014, 12:09:57 AM6/3/14
to tas...@googlegroups.com

How funny you should ask because I just tried it and it worked. Then I went back to variables and now it's working altogether! No idea what I changed, if anything. Now to do the mark as read! Haha I shall post back if I have problems with that one, but I don't foresee any issues since this one works now.

Thank you SO much for your help!

On Jun 3, 2014 12:06 AM, "Matt R" <matthew.r...@gmail.com> wrote:
What if you use fixed phone number and body instead of variables?

Matt

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/Pf762H_H5Bo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Daniel Dur

unread,
Jun 3, 2014, 6:09:43 AM6/3/14
to tas...@googlegroups.com
Sorry to jump in, but after seeing this being discussed quite some times before, I can only wonder why doesn't somebody come with a plugin that deals with SMS manipulation.

j ram

unread,
Jun 7, 2014, 10:55:36 AM6/7/14
to tas...@googlegroups.com
+1 for daniel d.
If possible would it be possible to do a step by step procedure. I am sure the entire forum would find it useful!

Daniel D

unread,
Oct 9, 2014, 8:23:59 AM10/9/14
to tas...@googlegroups.com
Heather, did you manage to manipulate the data in mmssms.db? If so, did you do anything special? Cause I cannot open the database in its original location, only if I copy it somewhere else.

Thanks!

Heather

unread,
Oct 9, 2014, 11:01:41 AM10/9/14
to tas...@googlegroups.com

Yeah I was able to without a problem. Can you access it via SQLite Debugger?

On Oct 9, 2014 8:24 AM, "Daniel D" <daniel.t...@gmail.com> wrote:
Heather, did you manage to manipulate the data in mmssms.db? If so, did you do anything special? Cause I cannot open the database in its original location, only if I copy it somewhere else.

Thanks!

--

Daniel D

unread,
Oct 9, 2014, 12:07:50 PM10/9/14
to tas...@googlegroups.com
I don't know what debugger you are talking about but I managed to access it via commands in the Terminal Emulator. But in Tasker, although I checked the <Root> option, it cannot open the database.

Heather

unread,
Oct 9, 2014, 12:36:17 PM10/9/14
to tas...@googlegroups.com

If you set it to store an error in a variable, do you get an error?

On Oct 9, 2014 12:08 PM, "Daniel D" <daniel.t...@gmail.com> wrote:
I don't know what debugger you are talking about but I managed to access it via commands in the Terminal Emulator. But in Tasker, although I checked the <Root> option, it cannot open the database.

--

Daniel D

unread,
Oct 9, 2014, 12:45:30 PM10/9/14
to tas...@googlegroups.com
Yeah, it's something like "Error: unable to open database[...]: unable to open database file". And it only happens with the actual database. If I copy mmssms.db to /sdcard/ then everything works.
I checked <Use Root> and executed <mount -o remount,rw /system> previous to opening the database.

Matt R

unread,
Oct 9, 2014, 1:11:46 PM10/9/14
to tas...@googlegroups.com
My first guess would be a problem with your mount action.  You can check in shell if it was mounted by using the command:

mount | grep system

Matt

Daniel D

unread,
Oct 9, 2014, 1:38:42 PM10/9/14
to tas...@googlegroups.com
I'm no linux CLI user and the answer seems to be tricky to find so the result is:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,data=ordered 0 0
Reply all
Reply to author
Forward
0 new messages