Android Question Send message greater than 160 chars PhoneSms.Send2

Daniel Towers

Member
Licensed User
How can I send an SMS greater than 160 characters using PhoneSms.Send2?

The code below does NOTHING. We don't get a crash, and the PE_SmsSentStatus is never called with success or error.

B4X:
Sub PE_SmsSentStatus(Success As Boolean, ErrorMessage As String, PhoneNumber As String, Intent As Intent) As Boolean
Log("MessageSentStatus: " & Success & " " & ErrorMessage & " " & PhoneNumber & " " & Intent.ExtrasToString)
End Sub

sub SendSMS
Dim p As PhoneSms
dim Mobile as string = "00000000000"
dim Message as string = "A MESSAGE LONGER THAN 160 CHARACTERS... PADDING ...  PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ... PADDING ..."
p.Send2(Mobile,Message,True,False)
End Sub
 

Daniel Towers

Member
Licensed User
Thank you Erel, yes - I found that, but was hoping that there was a better way - where I could get feedback when the message is sent. I tried adding
android.provider.Telephony.SMS_SENT to the :

AddReceiverText(SMSMagic_IN,

<intent-filter>

in my manifest - but it does not fire.
 
Last edited:
Upvote 0

Daniel Towers

Member
Licensed User
Hi Erel. When your library calls PE_SmsSentStatus - it has a uri (of the sent message) in the extras. How can I get this into the extras for the pending intent from the Java code (I am using my own Java code now to sendMultipartTextMessage).

Intent mSendIntent = new Intent("b4a.smssent");
mSendIntent.putExtra("uri", ???);
....
sm.sendMultipartTextMessage(PhoneNumber, null, parts, ReceiveSentNotification ? sentIntents : null, ReceiveDeliveredNotification ? deliveryIntents : null);
 
Upvote 0

Daniel Towers

Member
Licensed User
Thank you Erel. I got this working nicely - but the real problem is the irritating decision by Google to kill the ability to delete messages for everything apart from the default Messaging app. This is real nuicance, as I now have to code up a suitable replacement, just so I can delete messages
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…