While searching the internet I came across the topic of sending SMS but unfortunately I did not find any example for C ++ Builder. Everything is written in Delphi. I tried to rewrite the instructions in C ++ and got this code:
#include <Androidapi.Helpers.hpp>
#include <Androidapi.JNI.JavaTypes.hpp>
#include <Androidapi.JNI.Telephony.hpp>
#include <Androidapi.JNI.GraphicsContentViewText.hpp>
#include <Androidapi.JNI.App.hpp>
#include <Androidapi.JNI.Net.hpp>
JString* wiadomosc = StringToJString( L"Wiadomość" );
Jnet_Uri* URI;
JString* destAdress;
URI = StrToJURI( "12345678" ); // phone number
_di_JIntent Intent = TJIntent::JavaClass->init( TJIntent::JavaClass->ACTION_VIEW, URI ); //ACTION_VIEW ACTION_SEND
Intent->setType( StringToJString("text/plain") );
//Intent->putExtra( TJIntent::JavaClass->EXTRA_TEXT, wiadomosc ); StringToJString('sms_body')
Intent->putExtra( StringToJString("sms_body"), wiadomosc );
::SharedActivityContext()->startActivity( Intent );
//SharedActivity()->startActivity(Intent);
The program works but not as I've expected. The application selection window appears, and despite permanent SMS set as default I can not send sms without typing a phone number and text message even though that data is present in the code. Please give me a hint how to send sms without using the default program on Android.