How to send SMS without opening SMS native android app


#1

Hi All,

I have used the https://github.com/cordova-sms/cordova-sms-plugin plugin to send SMS through ionic android app. The problem is that it opens the native android SMS messaging app to send it. I want that my app sends SMS without opening any other app.


#2

var intent = ‘’; //leave empty for sending sms using default intent


#3

Hi sorry I did not get you :frowning:
Why is intent even used?


#4

In the Javascipt when:
var intent =‘INTENT’ > native android SMS messaging
var intent = ‘’ > send SMS without open any other app

$window.sms.send(number, message, intent, success, error);


#5

Thanks for this - the documentation on the plugin is lacking the explanation for the ‘intent’ parameter - this make sense, so thanks for clarifying.


#6

Hi Jimibi,

Thanks alot man!


#7

I will edit the documentation of this plugin.


#8

Hi! I am trying to use the sms plugin, but it’s not working. Do you mind offering some help?

I followed everything on github and put the two pieces of code in the following spots: the HTML went into my view, and the JAVASCRIPT went into my app.js ionic file after this line: “$urlRouterProvider.otherwise(’/tab/home’);”.

Nothing seems to be working. I also went onto github and cloned the cordova-sms-plugin-test, which also doesn’t work, even after I uploaded the file to my ionic viewer on my phone.

Any ideas? Thanks!


#9

Try to import ionic template app and build it


#10

Hey @amandalp,

I think, you injected the code at the wrong place, make sure to inject it in the app.run() instead of the config().


#11

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.


#12

@Gajotres I want to implement it ! But i have a doubt !

How the sms is sent to the the user ? via internet or user’s network connection ? Does it charge the user for sending the sms ?

I just want to send the otp on the user’s phone itself for verifying the number ! or is thr any better way to do this ?

Thanks !


#13

@Sumeet123 SMS is sent via a network connection. Technically nothing will change, only difference, you’ll use your own app to send an SMS.


#14

so it will charge the user right ? like in india suppose a telecom service charges 1 rupee per sms !
Since its using a telecom service !


#15

yup…it will…it is just another way of sending sms …as soon as the sms is sent the charges apply


#16

@pointdeveloper.com thanks for clearing the confusion ! please suggest some different way to cheive this which wont charge the user ! Thanks again


#17

for anybody looking for a step by step tutorial on how to use the SMS plugin in a real application here’s a tutorial on how to create an application for buying public transport tickets via SMS: http://www.coding-dude.com/wp/mobile-apps/ionic-app-tutorial-create-a-mobile-app-for-purchasing-public-transport-tickets-via-sms/


#18

Here’s an example in Ionic 2.


#19

can i do the same on ios without open any app ?