Send SMS from within app

Hi,

With one of the my web apps, i need to send SMS but it seems that the only way to send an SMS is still to leave the app and then send it from the messages section. This is not ideal for my application. I am not too keen on using some other service to allow me to do this.
Can this now be achieved all in AppStudio?

Thanks

The rules have changed. You can’t just send SMS/MMS messages.

On Cordova you use the social-plugin and SMS… while you can pre-fill all the fields, the user still has to press send.

Thanks for your response.

I have this same question - can you send an SMS message directly out of an appStudio app on a phone? Without Phonegap?

All you can do is pass the SMS to your message app using an intent. The message app then sends the message:

location.href="sms:" & tel & "&body=" & encodeURI(body)

You can probably see the potential for abuse if a web app was allowed to send SMS messages automatically by itself.

I have been sending a SMS directly from within the app without leaving it using PhoneGap.
I use this plugin:

<gap:plugin name="cordova-plugin-sms" source="npm" />

Then use this in AppStudio:

SMS.sendSMS(SMSnumber, SMStxt, SentSuccess, SentFail);

function SentSuccess(result) 
 {
 ...
 }
function SentFail(result) 
{
  ...
}

Great! I tried it but didn’t work. I got this message:

I want to use it with iPhones -

Thanks!

Are you referring to the not signed/No certificate message?

If so, click on the “not signed” link. You’re about to learn about signing apps for iPhones. There are a number of steps Apple requires you to take when making apps for iOS.

What is an ‘intent’?

Intents are specified in the config.xml as part of the white list process and their purpose is to specify which URLs the app is allowed to open.

<!-- Allow SMS links to open messaging app -->
<allow-intent href="sms:*" />

As for sending SMS directly, you can’t do that (anymore). There were too many abusers who would get their app installed on a users device and then use the device to spam other users and the unsuspecting users could get billed per message fees. It was a real mess. Apple locked it down years ago and shortly thereafter Android followed suit.

There used to be a plugin that was a “composer” so you passed in the message to send and the recipient and it would open the SMS app, populate the fields and the user would have to press send. It probably still exists but I can’t say for sure.

Intents are not just a config.xml thing. They’re things like tel:, mailto:, sms:. On iOS, they are called URL Schemes.