Sending SMS using ionic

I have ussed Eclipse Android to build an Android app where I ask a few querstions and on completion send an SMS to a hardcdoded mobile tel number. The ap will ask for permissions to send sms’ and the hardcoded tel number is transparent to the user of the app.

My question is: Can I build the same app using ionic - I have not yet seen how to send the sms in the documentation. If I missed it, please just point me in the right direction :smile:

The whole ionic development is absolutely incredibe! Tripple thumbs up for this.

you must use a Cordova plugin to do that, i use this:
https://github.com/aharris88/phonegap-sms-plugin”, only for sending.

1 Like

Sounds perfect - I only need to do a send. Thank you.

I don’t seem to be able to do the plugin install. This is the results I get after issuing the phonegap command:

~/AsmaEval$ sudo phonegap local plugin add https://github.com/aharris88/phonegap-sms-plugin.git
[warning] The command phonegap local <command> has been DEPRECATED.
[warning] The command has been delegated to phonegap <command>.
[warning] The command phonegap local <command> will soon be removed.
Fetching plugin “https:/github.com/aharris88/phonegap-sms-plugin.git” via git clone

Error: Command failed: Cloning into ‘/tmp/plugman/git/1416504079109’…
ssh: Could not resolve hostname https: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at ChildProcess.exithandler (child_process.js:647:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

I had to use su as it wants to ssh into the url where the plugin lives. Because I run in superiuser mode I expect to have the required access rights… so I have no idea what to try next. Any suggestions?

if you use the new Phonegap CLI the command was deprecated, you can use this:
phonegap plugin add …

I don’t have phonegap installed for test, I use Cordova CLI

I tried it before I posted the previous post. \i did agin and get the same response:
~/AsmaEval$ sudo phonegap plugin add https://192.30.252.128/aharris88/phonegap-sms-plugin.git
Fetching plugin “https:/192.30.252.128/aharris88/phonegap-sms-plugin.git” via git clone

Error: Command failed: Cloning into ‘/tmp/plugman/git/1416510670445’…
ssh: Could not resolve hostname https: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at ChildProcess.exithandler (child_process.js:647:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Socket.<anonymous> (child_process.js:966:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)

The alternative may be to do a wget for this plugin, but where do I store it to do a phonegap install of the downloaded plugin? Thanks for your help, any suggestions will be apreciated.

I tried this:
~/AsmaEval$ cordova plugin add https://github.com/aharris88/phonegap-sms-plugin.git
Fetching plugin “https://github.com/aharris88/phonegap-sms-plugin.git” via git clone
Installing “org.apache.cordova.plugin.sms” for android

and then list the plugins:

~/AsmaEval$ phonegap plugin list
com.ionic.keyboard 1.0.3 "Keyboard"
org.apache.cordova.console 0.2.11 "Console"
org.apache.cordova.device 0.2.12 "Device"
org.apache.cordova.plugin.sms 0.1.0 “Sms”

So I sincerely hope it is all ok now. did phonegap build android and will test the plugin soon.

Hi guys, I wrote a whole tutorial for you, find it here.

If you need more information feel free to ask, I’m always here.

I wrote it from the Android perspective. I tested everything on a real device and code us reusable.

No permissions are required, everything is configured automatically.

1 Like

is there any method to send sms to the mobile number as call method in ionic?