Android Question SMS not sent. Tap to try again.

walt61

Active Member
Licensed User
Longtime User
Hi all,

Has anyone come across this issue and found a solution? Context: my mobile isn't dual SIM, so I created an app that 'sends' the SMS to a database (receiving works similarly) from which it is picked up by a spare 'server' mobile, which actually sends and reads the SMS's. This 'server' will stay at home, while my usual mobile will be wherever I go, thus avoiding the need to carry 2 mobiles (and offering a hobby project opportunity :)).

That seemed quite straightforward, but some SMS's got sent and others weren't - no error condition arose. I thought perhaps the spare mobile's environment was causing it (Samsung Galaxy S3 with Cyanogen 12.1, also tested with Lineage, same result), so I used another one; this time stock Android 6.0, and discovered a wonderful new condition: the one in the thread's title (some SMS's get sent too, and some don't show up in the messaging app at all, like before).

So apparently the SMS - sometimes - makes it to the (standard Android) messaging app but gets stuck there. Tapping it does indeed send it out but as mentioned I don't want to carry 2 phones around.

On forums I've read that installing another messaging app helped for some people, but that's a workaround (if it works at all) and I'd prefer a solution. I've used these 2 methods for sending (with and without sent notification), same result:

B4X:
Dim SMS As PhoneSms
Dim receiveSentNotification As Boolean = True
SMS.Send(toNumber, theText)
SMS.Send2(toNumber, theText, receiveSentNotification, False)

I've also tried with @Sorin Pohontu 's code from https://www.b4x.com/android/forum/threads/phonelibrary-updated-phonesms-send.52501/ but again no change.

The only other option I can think of (besides trying another messaging app) is, after sending, waiting some seconds and checking with ContentResolver if the SMS shows up as sent but perhaps that's overkill?

Hints are more than welcome, I'm kinda stuck :).

Thanks as always,

walt61
 

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Did you monitor the status of the Send3 method to see if the SMS was actually sent? Is your carrier reporting sent when in fact it was not? If so, then there's nothing you can do about it.

In the solution I implemented for my project, when that status was not successful I re-sent the message and incremented a retry-counter (after "X" many retries I just logged it as not sent and moved on).
 
Upvote 0

walt61

Active Member
Licensed User
Longtime User
Indeed, I monitored that status, but nothing came in. It looks like the SMS doesn't make it to the messaging app/queue at all, at least not with my first tests: it was nowhere to be seen, no error was thrown, no 'sent' feedback was received (which I considered normal as I didn't see the message anywhere at all, except in my db, where it was flagged by my app as 'sent' after having used any of the 3 aforementioned approaches).

The 'tap to try again' was a new condition; I haven't given the notifications another shot yet as it's hit and miss: sometimes it works, sometimes nothing at all seems to happen, and now this new situation came up. I'll give it another shot by checking the sent notifications, thanks again for your input. (Mind you, I thought I was missing something essential as things happen so intermittently that everybody would have given up on SMS if this was biz as usual :)).
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
If you are handling the PhoneEvents library's SmsSentStatus event and it is not firing, then I would guess the default messaging app is consuming the event.

If your app is not the default messaging app then there may be some way to interact with intents from the default messaging app, I'm not very well versed in the actual messaging API. In my case, the device being used was a company-owned device so our app was the only messaging app on it and we controlled both sending and receiving.
 
Upvote 0

walt61

Active Member
Licensed User
Longtime User
Found it! And posting here in case someone else would run into this issue. The root cause is that, when using unicode characters (like emojis), the maximum message length is 70. Of course it didn't help that, depending on its version, Android's stock messaging app doesn't return any kind of error and doesn't seem to do anything with the message, or shows the error 'SMS not sent. Tap to try again.' (and when you then tap it, it is indeed sent, which adds to the confusion).

So the solution was indeed to use @Sorin Pohontu 's code (actually I wound up using @janderkan 's from https://www.b4x.com/android/forum/threads/one-sms-module-all-inclusive.58782/, which in turn uses Sorin's) and changing '160' to '70' in that module and now it's running swimmingly :) On to the next challenge!
 
Upvote 0
Top