Page 1 of 3

Operation on SMS

Posted: 17 Dec 2017 16:55
by akhileshg1988
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).

Re: Operation on SMS

Posted: 17 Dec 2017 17:15
by Desmanto
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

Re: Operation on SMS

Posted: 18 Dec 2017 02:21
by akhileshg1988
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.

Re: Operation on SMS

Posted: 18 Dec 2017 06:51
by bogdyro
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.

Re: Operation on SMS

Posted: 18 Dec 2017 07:14
by Desmanto
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.

Re: Operation on SMS

Posted: 19 Dec 2017 10:26
by akhileshg1988
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

Re: Operation on SMS

Posted: 19 Dec 2017 16:45
by bogdyro
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.

Re: Operation on SMS

Posted: 19 Dec 2017 16:49
by akhileshg1988
Thanks a lot brother.
I'm in.
But where's the flow?

Re: Operation on SMS

Posted: 19 Dec 2017 16:56
by bogdyro

Re: Operation on SMS

Posted: 19 Dec 2017 17:13
by akhileshg1988
"Sqlite Installer for root" apk installed.
Downloading your flow.
Let me try my hand @ it.