Operation on SMS

Post your questions and help other users.

Moderator: Martin

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Operation on SMS

Post by akhileshg1988 » 17 Dec 2017 16:55

Is there a way by which Automagic can pull a specific sms from my inbox?
Something similar to "Init Variable File List" wherein automagic returns a list of all the files inside a specified folder and then I can perform various operations on the desired file(s).

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Operation on SMS

Post by Desmanto » 17 Dec 2017 17:15

Do you want only the body text of the messages?

Use Action Query Content Provider. I think some of the init variable action also use this method under the hood.
Content URI : content://sms/inbox
Projection : body (or you can choose other field using the ellipsis)
Result Type : List or Table
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: Operation on SMS

Post by akhileshg1988 » 18 Dec 2017 02:21

Desmanto wrote:Do you want only the body text of the messages?
What I want to accomplish is that as soon as any sms arrives, Automagic should generate a notification for that in the ststus bar (exactly like andriod does). However, android doesn't provide any option of deleting the received sms straightaway from the notification. I want the notification generated by Automagic to have a "Delete SMS" button right below the sms body. On pressing that "Delete SMS" button, the SMS should get deleted from my inbox.

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Operation on SMS

Post by bogdyro » 18 Dec 2017 06:51

Hi. You could use trigger sms received to build your notification.
However actually deleting it is not simple.
I tried using Java functions but it doesn't work. No error,just no record deleted.
Maybe it has something to do with the fact that an app has to be the default sms app to do this.
Maybe Martin could clarify that.
I know there has been a thread about this some time ago. Didn't find it.
Are you rooted? Maybe then you could delete the sms directly from the database.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Operation on SMS

Post by Desmanto » 18 Dec 2017 07:14

Content provider only provide you the content. For SMS, it doesn't allow you to delete it. So you can only use execute root command to delete the row directly using sqlite3. Removing notification and replacing it with automagic's one with additional action button is easy. The hardest part is with the sms deleting. I haven't tried yet with the sqlite3 command, but I know it can be done.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: Operation on SMS

Post by akhileshg1988 » 19 Dec 2017 10:26

Desmanto wrote:Content provider only provide you the content. For SMS, it doesn't allow you to delete it. So you can only use execute root command to delete the row directly using sqlite3. Removing notification and replacing it with automagic's one with additional action button is easy. The hardest part is with the sms deleting. I haven't tried yet with the sqlite3 command, but I know it can be done.
Can you help guide me with it?

Akhilesh Chandra Gairola

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Operation on SMS

Post by bogdyro » 19 Dec 2017 16:45

Hi. I'M currently making a flow for this which is gonna be a proof of concept,not very polished :)
Your phone has to be rooted and you would have to do a couple of modifications to the flow maybe for it to work on your particular device.
so...
install sqlite3 with this app from the play store
https://play.google.com/store/apps/deta ... ato.sqlite
find out the location of the sms database using a root explorer
mine is located here (Android 7.1.1)
/data/user_de/0/com.android.providers.telephony/databases/mmssms.db

I recommend that you copy this file to an easy location and give this path to the flow to protect your actual messages.

Download the flow. Running it manually should get your last received SMS and display it. If there are errors maybe sqlite isn't set up properly or the path is incorrect.
If you get a dialog box with a valid sms and you click OK afterwards it WILL DELETE IT.
If everything works we can do the other requirements.

akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: Operation on SMS

Post by akhileshg1988 » 19 Dec 2017 16:49

Thanks a lot brother.
I'm in.
But where's the flow?

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Operation on SMS

Post by bogdyro » 19 Dec 2017 16:56


akhileshg1988
Posts: 109
Joined: 16 Apr 2014 04:57

Re: Operation on SMS

Post by akhileshg1988 » 19 Dec 2017 17:13

"Sqlite Installer for root" apk installed.
Downloading your flow.
Let me try my hand @ it.

Post Reply