how to send a SMS using droidscript

96 views
Skip to first unread message

Erik Beltran

unread,
Apr 27, 2024, 7:49:51 AMApr 27
to DroidScript
I guess is required a ds-x version?
someone have the link, and a functional example?
thanks!

Dave

unread,
May 2, 2024, 9:09:19 AMMay 2
to DroidScript
Currently the X version only exists for v2.66


Here is an example -

/*
  WARNING: Google Play no longer allows SMS apps to be
  uploaded, except in certain special circumstances.
*/

//Called when application is started.
function OnStart()
{  
//Create layout that fills the screen.
lay = app.CreateLayout( "Linear", "FillXY,VCenter" )

//Create text edit control for phone number.
txtNum = app.CreateTextEdit( "5550101", 0.8, -1 )
lay.AddChild( txtNum )

//Create text edit control for message.
txtMsg = app.CreateTextEdit( "Hello from Android!", 0.8, 0.3 )
lay.AddChild( txtMsg )

//Create 'Send' button.
btn = app.CreateButton( "Send", 0.4, 0.1 )
btn.SetOnTouch( btn_OnTouch )
lay.AddChild( btn )

//Add main layout to app.
app.AddLayout( lay )

//Create SMS object and set callbacks.
sms = app.CreateSMS()
sms.SetOnStatus( sms_OnStatus )
sms.SetOnMessage( sms_OnMessage )
}

//Handle 'Send' button.
function btn_OnTouch()
{
//Send the SMS message.
sms.Send( txtNum.GetText(), txtMsg.GetText() )
}

//Show SMS send status/progress.
function sms_OnStatus( status )
{
app.ShowPopup( status )
}

//Show in-comming SMS messages.
function sms_OnMessage( number, msg )
{
app.ShowPopup( number + ": " + msg )
}

Message has been deleted

Dave

unread,
May 3, 2024, 5:05:30 AMMay 3
to DroidScript
I meant v2.61

Reply all
Reply to author
Forward
0 new messages