Search code examples
androidsmstasker

Get failed sent SMS on Samsung Android device with Tasker app


I need automatically try to resend failed outgoing SMS on Samsung Android (Galaxy S10) device after some period of time (due to poor signal quality, no credits, no SIM card inserted e.t.c.).

I have found Tasker app (any other ways/suggestions to do this thing would be also OK).

I have tried to catch Tasker SMS Failure event, but it doesn't help. In the manual there is a note for this event: Only works for an SMS sent by Tasker's Send SMS action. But I need to catch failure event from native SMS app.

I have also tried to catch Intent com.samsung.intent.action.SMS_SEND_FAIL with Tasker. It doesn't work too (may be wrong intent name?).

LogCat entry parsing is also useless, because of no SMS data contains (I need SMS receiver phone number and text to try resending).

And finally I have tried to get SMS from phone internal native database, but I could get only successfully sent messages and inbox:

content://sms/inbox - OK (incoming SMS)

content://sms/sent - OK (successfully sent)

content://sms - OK (inbox + sent)

content://sms/all - empty

content://sms/failed - empty

content://sms/queued - empty

content://sms/draft - empty

content://sms/outbox - empty

content://sms/undelivered - empty

Any other solutions? Many thanks!


Solution

  • Here is my dirt solution (root required).

    <TaskerData sr="" dvi="1" tv="6.1.32">
     <Profile sr="prof12" ve="2">
      <cdate>1691745640721</cdate>
      <edate>1691750328401</edate>
      <flags>8</flags>
      <id>12</id>
      <limit>true</limit>
      <mid0>13</mid0>
      <nme>Failed SMS Retry</nme>
      <Time sr="con0">
       <fh>6</fh>
       <fm>0</fm>
       <rep>2</rep>
       <repval>10</repval>
       <th>23</th>
       <tm>0</tm>
      </Time>
     </Profile>
     <Task sr="task13">
      <cdate>1691745663215</cdate>
      <edate>1691750291965</edate>
      <id>13</id>
      <nme>Process Failed Sms</nme>
      <pri>100</pri>
      <Action sr="act0" ve="7">
       <code>667</code>
       <Int sr="arg0" val="0"/>
       <Str sr="arg1" ve="3">/data/data/com.android.providers.telephony/databases/mmssms.db</Str>
       <Int sr="arg10" val="1"/>
       <Str sr="arg2" ve="3"/>
       <Str sr="arg3" ve="3"/>
       <Str sr="arg4" ve="3">SELECT _id, address, body, type FROM sms WHERE [type] = 5 ORDER BY _id ASC LIMIT 1</Str>
       <Str sr="arg5" ve="3"/>
       <Str sr="arg6" ve="3"/>
       <Str sr="arg7" ve="3">∆</Str>
       <Str sr="arg8" ve="3">%SMSES</Str>
       <Int sr="arg9" val="0"/>
      </Action>
      <Action sr="act1" ve="7">
       <code>548</code>
       <on>false</on>
       <Str sr="arg0" ve="3">%SMSES(1)</Str>
       <Int sr="arg1" val="1"/>
       <Str sr="arg10" ve="3"/>
       <Int sr="arg11" val="1"/>
       <Int sr="arg12" val="0"/>
       <Str sr="arg13" ve="3"/>
       <Int sr="arg14" val="0"/>
       <Str sr="arg15" ve="3"/>
       <Int sr="arg2" val="0"/>
       <Str sr="arg3" ve="3"/>
       <Str sr="arg4" ve="3"/>
       <Str sr="arg5" ve="3"/>
       <Str sr="arg6" ve="3"/>
       <Str sr="arg7" ve="3"/>
       <Str sr="arg8" ve="3"/>
       <Int sr="arg9" val="1"/>
      </Action>
      <Action sr="act2" ve="7">
       <code>547</code>
       <Str sr="arg0" ve="3">%SMS</Str>
       <Str sr="arg1" ve="3">%SMSES(1)</Str>
       <Int sr="arg2" val="0"/>
       <Int sr="arg3" val="0"/>
       <Int sr="arg4" val="0"/>
       <Int sr="arg5" val="3"/>
       <Int sr="arg6" val="1"/>
       <ConditionList sr="if">
        <Condition sr="c0" ve="3">
         <lhs>%SMSES(#)</lhs>
         <op>0</op>
         <rhs>1</rhs>
        </Condition>
       </ConditionList>
      </Action>
      <Action sr="act3" ve="7">
       <code>590</code>
       <Str sr="arg0" ve="3">%SMS</Str>
       <Str sr="arg1" ve="3">∆</Str>
       <Int sr="arg2" val="1"/>
       <Int sr="arg3" val="0"/>
       <ConditionList sr="if">
        <Condition sr="c0" ve="3">
         <lhs>%SMSES(#)</lhs>
         <op>0</op>
         <rhs>1</rhs>
        </Condition>
       </ConditionList>
      </Action>
      <Action sr="act4" ve="7">
       <code>548</code>
       <on>false</on>
       <Str sr="arg0" ve="3">%SMS3</Str>
       <Int sr="arg1" val="1"/>
       <Str sr="arg10" ve="3"/>
       <Int sr="arg11" val="1"/>
       <Int sr="arg12" val="0"/>
       <Str sr="arg13" ve="3"/>
       <Int sr="arg14" val="0"/>
       <Str sr="arg15" ve="3"/>
       <Int sr="arg2" val="0"/>
       <Str sr="arg3" ve="3"/>
       <Str sr="arg4" ve="3"/>
       <Str sr="arg5" ve="3"/>
       <Str sr="arg6" ve="3"/>
       <Str sr="arg7" ve="3"/>
       <Str sr="arg8" ve="3"/>
       <Int sr="arg9" val="1"/>
      </Action>
      <Action sr="act5" ve="7">
       <code>667</code>
       <Int sr="arg0" val="0"/>
       <Str sr="arg1" ve="3">/data/data/com.android.providers.telephony/databases/mmssms.db</Str>
       <Int sr="arg10" val="1"/>
       <Str sr="arg2" ve="3"/>
       <Str sr="arg3" ve="3"/>
       <Str sr="arg4" ve="3">DELETE FROM sms WHERE [type] = 5 AND _id = %SMS1</Str>
       <Str sr="arg5" ve="3"/>
       <Str sr="arg6" ve="3"/>
       <Str sr="arg7" ve="3"/>
       <Str sr="arg8" ve="3">%XXX</Str>
       <Int sr="arg9" val="0"/>
       <ConditionList sr="if">
        <Condition sr="c0" ve="3">
         <lhs>%SMSES(#)</lhs>
         <op>0</op>
         <rhs>1</rhs>
        </Condition>
       </ConditionList>
      </Action>  
      <Action sr="act6" ve="7">
       <code>667</code>
       <Int sr="arg0" val="0"/>
       <Str sr="arg1" ve="3">/data/data/com.android.providers.telephony/databases/mmssms.db</Str>
       <Int sr="arg10" val="1"/>
       <Str sr="arg2" ve="3"/>
       <Str sr="arg3" ve="3"/>
       <Str sr="arg4" ve="3">UPDATE sms SET [type] = 2 WHERE [type] = 5 AND _id = %SMS1</Str>
       <Str sr="arg5" ve="3"/>
       <Str sr="arg6" ve="3"/>
       <Str sr="arg7" ve="3"/>
       <Str sr="arg8" ve="3">%XXX</Str>
       <Int sr="arg9" val="0"/>
       <ConditionList sr="if">
        <Condition sr="c0" ve="3">
         <lhs>%SMSES(#)</lhs>
         <op>0</op>
         <rhs>1</rhs>
        </Condition>
       </ConditionList>
      </Action>
      <Action sr="act7" ve="7">
       <code>41</code>
       <Str sr="arg0" ve="3">%SMS2</Str>
       <Str sr="arg1" ve="3">%SMS3</Str>
       <Int sr="arg2" val="0"/>
       <Str sr="arg3" ve="3"/>
       <Int sr="arg4" val="0"/>
       <ConditionList sr="if">
        <Condition sr="c0" ve="3">
         <lhs>%SMSES(#)</lhs>
         <op>0</op>
         <rhs>1</rhs>
        </Condition>
       </ConditionList>
      </Action>
     </Task>
    </TaskerData>