通过 HTML5/JavaScript 从手机发送短信
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22984539/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending an SMS from mobile via HTML5/JavaScript
提问by Jorge B.
I'm creating a web application for mobile devices that will be downloaded in one of the markets with a mini web server and run on any OS ( iOS , android , Windows8 , etc. ) .
我正在为移动设备创建一个 web 应用程序,该应用程序将在一个市场中下载,并带有一个迷你 web 服务器并在任何操作系统(iOS、android、Windows8 等)上运行。
I want an application to be as independent as possible of the OS. I only wanted to use HTML5
and JavaScript
.
我希望应用程序尽可能独立于操作系统。我只想使用HTML5
和JavaScript
。
The application allows a user to make a number of orders just by clicking buttons. Example : [List contacts ]
该应用程序允许用户只需单击按钮即可下订单。示例:[列出联系人]
I need to click [List contacts ] and is sent a text message automatically to other mobile device with an android application that receives the request and sends the response via sms . The response has to be read by my web application . The application can be able to work without network / Wifi .
我需要单击 [列出联系人] 并自动向其他移动设备发送一条短信,其中包含接收请求并通过 sms 发送响应的 android 应用程序。响应必须由我的 Web 应用程序读取。该应用程序可以在没有网络/Wifi 的情况下工作。
I've been searching and I only found ways to open the native application for sending sms.
我一直在搜索,我只找到了打开本机应用程序发送短信的方法。
I see that question, but I want to create my own way to send sms without dependencies of other applications.
我看到了那个问题,但我想创建自己的方式来发送短信,而无需依赖其他应用程序。
Is there any way to make this submission automatically?
有没有办法让这个自动提交?
Or can I use/create some plugin to use on JavaScript to do that?
或者我可以使用/创建一些插件来在 JavaScript 上使用吗?
[EDIT] Can thismight be a possibility? Can someone explain me?
[编辑]这可能是一种可能性吗?有人可以解释我吗?
回答by harriha
I believe the essential information was already mentioned in the comments, but my 2c here anyway.
我相信评论中已经提到了基本信息,但无论如何我的 2c 在这里。
As already commented, with current modern mobile operating systems apps don't get unlimited access to SMS functionality. From the user point of view allowing this would be potentially quite a hazard, since SMS's usually cost money and user should be in control of such activity, instead of having a random app sending and receiving SMS's freely (without user knowing it). Android is a bit more flexible regarding this kind of functionality, but as mentioned, iOS and also Windows 8/Windows Phone 8 only allows you to integrate to the SMS sending application and for SMS reception, there's no proper way to get access to incoming SMS's.
正如已经评论过的,使用当前的现代移动操作系统应用程序无法无限制地访问 SMS 功能。从用户的角度来看,允许这将是一个潜在的危险,因为 SMS 通常要花钱,用户应该控制此类活动,而不是让随机应用程序免费发送和接收 SMS(用户不知道)。Android 在此类功能方面更加灵活,但如前所述,iOS 和 Windows 8/Windows Phone 8 仅允许您集成到 SMS 发送应用程序和 SMS 接收,没有正确的方法来访问传入的 SMS .
So, with a native container (such as PhoneGap) you could get one step forward with Android, but for other platforms the possibilities are limited to using the native SMS application. If you need to use SMS for some reason in the backend side, services such as Twilio are probably your best shot, but using SMS locally on the device is pretty much a no-go, unfortunately.
因此,使用本机容器(例如 PhoneGap),您可以在 Android 上向前迈出一步,但对于其他平台,可能性仅限于使用本机 SMS 应用程序。如果您出于某种原因需要在后端使用 SMS,Twilio 等服务可能是您最好的选择,但不幸的是,在设备上本地使用 SMS 几乎是行不通的。