function sendSms(msg, number)
{
var packageName = null, className = null;
var action = "android.intent.action.VIEW";
var category = null, uri = null;
var type = "vnd.android-dir/mms-sms";
var extras = JSON.stringify(
[
{name: "address", type: "string", value: number},
{name: "android.intent.extra.TEXT",
type: "string", value: msg}
]);
app.SendIntent( packageName, className,
action, category, uri, type, extras );
}Sorry to report that neither of my devices do anything at all.
Bean 4.1.2 and LineageOS 15.1 (8.1)
However, I am rooted on both devices and habe the default sms app frozen and use a secure sms (silence). Not sure if that is why... but wanted to let you know.
I'm seeing no error, nothing. DS doesn't do a thing.
All it does is to send an intent which should be picked up by the default sms app whick includes extras for text and number.
If you have no contactable app that is capable of sending sms, I would expect it to fail silently. I'm not looking for a return value. I'm not even sure if there would be one.
Just doesn't get opened by that intent.
Hmmm.
It seemed easiest to ask for input (as it was 3am) rather than just suggest Dave added app.SendSms()
Incidentally, Icode-GO was a tremendous help in producing the shortened code I suggested to him.
app.SendSms=function(msg,number){app.SendIntent(null,null,"android.intent.action.VIEW",null,null,"vnd.android-dir/mms-sms",JSON.stringify([{name:"address",type:"string",value:number},{name:"android.intent.extra.TEXT",type:"string",value:msg}]));}
An apk definitely doesn't request any permissions on my phone and the app works fine.
Having said that, it looks like the rules changed once or twice, most notably with the release of KitKat. There's a surprise!
function sendSms(msg, number)
{
var packageName = null,
className = null;
var action = "android.intent.action.SENDTO";
var category = null,
uri = 'smsto:'+number;
var type = null;
var extras = JSON.stringify(
[
{name: "sms_body", type: "string", value: msg}
function OnStart()
{
var lay = app.CreateLayout("linear", "VCenter,FillXY");
edtNum = app.CreateTextEdit("555-0100", -1, -1, "Number,SingleLine");
edtNum.SetHint( "Number" );
lay.AddChild(edtNum);
edtMsg = app.CreateTextEdit("Hello World!\nLove from Steve", -1, -1, "");
edtMsg.SetHint( "Message" );
lay.AddChild(edtMsg);
var btn = app.CreateButton("Send");
btn.SetOnTouch(btn_OnTouch);
lay.AddChild(btn);
app.AddLayout(lay);
}
function btn_OnTouch()
{
var m = edtMsg.GetText(),
n = edtNum.GetText();
app.SendSms(m, n);
}
app.SendSms=function(msg,number){app.SendIntent(null,null,"android.intent.action.SENDTO",null,'smsto:'+number,null,JSON.stringify([{name:"sms_body",type:"string",value:msg}]));}
//There is an X version of DroidScript 1.78 which you can install at http://androidscript.org/apk/DroidScript_178/X/
But beware, do not attempt to upload any APK built with the X Version to Google Play, they will have forbidden permission skeletons in their manifest, whether or not your app is using SMS.
However, I would start looking at https://support.google.com/googleplay/android-developer/answer/9047303?hl=en-GB
It sounds like you have installed the apkbuilder plugin correctly.
The simplest way to check is to build an APK with minimal SMS functionality in it (just copy the SMS sample) and see if it works.
The skeletons for SMS are not the only difference between the standard and X versions.
The other thing that springs to mind is the COSU stuff for true kiosk apps on Company Owned Single Use devices.
Personally, I would never take the risk of uploading any app built with the X version of DroidScript to Google Play, even if I believed I could make a good case for needing SMS.
By all means build APKs for your own use. I used one until recently to reply to SMS messages while I'm driving saying basically "I'm driving right now. I will read and respond to your message when it is safe and legal to do so"
It is fine to share those APKs with your friends. I put the APKs on Google Drive and send my friends a link but you could upload them wherever you think appropriate.
But I sincerely believe that if I uploaded apps built with the X version to Google Play I would risk my account being suspended or worse, no matter how pure my intentions.