Send sms from a mobile device via HTML5/javascript

Asked

Viewed 4,852 times

8

I am creating a WEB application for mobile device that will be downloaded in one of the stores, with a mini WEB server integrated and that works on any operating system(iOS, android, Windows8, etc).

In order for the application to be as independent as possible from the operating system I just wanted to use HTML5 and JavaScript.

The app allows a user to make a series of requests by just clicking buttons. Example: [See contacts]

I need that when clicking [View contacts] send a sms automatically to another mobile device with an application android who receives the request, handles and sends the reply via sms. The reply also has to be read by my WEB application. This for the application to work without mobile/Wifi network.

I’ve been searching and only find ways to open the text messaging app on my mobile device.

Is there any way to make this upload automatically?

And if it doesn’t exist, can it be done otherwise? Like use/create a plugin to use Javascript to do this for me?

[EDIT] Vi this yesterday and I’ve been researching on the subject, but it seems that the work was discontinued, unfortunately. I don’t even know if it would be a possibility.

  • 4

    You will need a server-side language, C#, Java, PHP, and more. Since HTML5 and java script is only a front-end language.

  • There is no chance to do this with HTML5 and javascript only?

  • there is even the possibility of html+javascript doing this, but when there is something on the server for this, ex: there are components where javascript could read and post, but of course.. usually this back-end is developed by the same person from the front end..

  • 3

    I added the Android tag I believe the community of Android programmers can help.

  • 1

    You have even considered the possibility of using an SMS sending web service like the Zeep Mobile (has free version with the inclusion of advertising) or the Zenvia?

  • I can not, it has to be sent by the mobile device itself, is one of the requirements to be able to work offline.

Show 1 more comment

2 answers

14


Currently there is no way to send SMS only with HTML without writing native code, the closest you will get is to open the messaging application with the fields filled, to do this use.

<a href="sms:99999999?body=Oi">Clique para enviar oi</a>

The syntax is:

sms[to]://[<destination number>][?parameters].

The phone number parameter is optional.

If you really want to send this without opening the Android Sender the modes are:

  1. With javascript you call some function on a web server (Asp.net, php, etc.) that sends the SMS p/you.
  2. Create native Android code that intercepts HTML action and send.

Sources:

http://paulohdsousa.blogspot.com.br/2014/04/android-enviar-sms-utilizando-html.html

https://stackoverflow.com/questions/12869297/html5-mobile-app-vs-email-sms

https://stackoverflow.com/questions/5721437/how-to-initiate-send-sms-from-a-html5-webpage-using-devices-native-functions

http://answers.oreilly.com/topic/2166-how-to-send-a-text-message-from-your-mobile-website/

  • And if it doesn’t exist, can it be done differently? Like use/create a plugin to use Javascript to do this? And compatible with the various operating systems?

  • 1

    The only way is by javascript you call some function on a web server (Asp.net, php, etc) that does this. or else some native Android code.

  • 'Cause I know that, but then I can’t get what I need.

  • @Jorgeb. I don’t understand why. If you create a SMS sending API in a server side language, you can call it quiet with pure JS. Surely there is a service that makes this possible. If you want to send SMS natively from the device, very likely there are Apis for this too, if it is something considered acceptable by the developer of OS.

  • 2

    I think the main reason is security. There is the possibility of you "hack" Android to "force" the system to send an SMS message. If this were possible it would become chaos with several web pages performing this procedure (for evil, of course!).

  • @Tiagocésaroliveira if I do this is guaranteed to work on most OS and no internet connected?

  • From what I understand, you want to use SMS sending from the device itself. I do not know if you can do this with JS. If so, it is an API of the OS developer itself.

  • @Tiagocésaroliveira yes that’s right. That’s why it’s complicated, on top of which it has to be compatible with all OS.

  • managed to make ?

Show 4 more comments

1

  • But these plugins are not in java and objetive-c code?

  • They are used through javasdript language

  • I went to see the plug-in, and it’s done on Android to use later with Javascript. Not for me, but thanks anyway.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.