(ChatGPT)
It seems that with the latest updates to Google's Messages app, handling the sms_body extra through Intent is no longer working as expected, potentially due to restrictions or changes related to RCS (Rich Communication Services).
To ensure compatibility with all SMS apps, including Google's, consider trying the following approach:
1. Use ACTION_SENDTO
Google recommends using Intent.ACTION_SENDTO instead of Intent.ACTION_VIEW when dealing with SMS to ensure compatibility with all messaging apps, including Google's SMS app with RCS.
You can try this code:
Dim Intent1 As Intent
Intent1.Initialize(Intent.ACTION_SENDTO, "smsto:" & PhoneNumber)
Intent1.PutExtra("sms_body", TextMessage)
StartActivity(Intent1)
2. Handle SMS Permissions
If your app sends SMS or needs to prefill messages, make sure you request the necessary SMS permissions in your AndroidManifest.xml:
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
3. Fallback if Pre-filling Fails
Since Google's Messages app may ignore the sms_body extra, one workaround is to prefill the message manually via code (copy to clipboard or provide it for the user to paste). You can use the clipboard as a backup if the body does not prefill:
Dim clip As Clipboard
clip.Initialize
clip.SetText(TextMessage)
ToastMessageShow("Message copied. Paste it into the SMS app.", False)
Dim Intent1 As Intent
Intent1.Initialize(Intent.ACTION_SENDTO, "smsto:" & PhoneNumber)
StartActivity(Intent1)
This way, users can manually paste the message if the app doesn’t automatically include it.