发送和读取通过Cordova中的本机SMS应用发送的SMS内容 [英] Send and read the SMS content sent via native SMS app in Cordova

查看:107
本文介绍了发送和读取通过Cordova中的本机SMS应用发送的SMS内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建Ionic/Cordova应用程序.在我的应用程序中,用户可以单击电话号码以发送短信.当单击该号码时,本机SMS应用程序将打开,然后用户可以键入自己的SMS并发送该SMS.有什么办法可以从我的应用程序中获取SMS内容?

I'm building an Ionic/Cordova app. From my application, user can click on a phone number in order to send SMS. When click on that number, native SMS app will open and then user can type his/her own SMS and send the SMS. Is there any way, from my app I can get the SMS content?

推荐答案

在使用ionic/cordova时,需要SMS插件才能进行此类工作.

As you are using ionic/cordova, a SMS plugin is required to do such work.

除了jsmobile SMS插件外,还有另一个具有更多API的插件: http://plugins.cordova.io/#/package/com.rjfun.cordova.sms

Besides jsmobile SMS plugin, there is another one with more APIs: http://plugins.cordova.io/#/package/com.rjfun.cordova.sms

如说明中所述:

sendSMS(address(s), text, successCallback, failureCallback);
listSMS(filter, successCallback, failureCallback);
deleteSMS(filter, successCallback, failureCallback);

startWatch(successCallback, failureCallback);
stopWatch(successCallback, failureCallback);

enableIntercept(on_off, successCallback, failureCallback);
restoreSMS(msg_or_msgs, successCallback, failureCallback);

事件

'onSMSArrive'

您可以通过以下两种方式之一来获取SMS内容:

You can get the SMS content in either of the following ways:

  1. 实现UI,获取用户输入,并调用插件的API发送SMS.

或者,

  1. 让默认的SMS应用发送消息,然后从发送的框中读取SMS.

顺便说一句,该插件仅适用于Android,仅供参考.

BTW, the plugin works for Android only, FYI.

这篇关于发送和读取通过Cordova中的本机SMS应用发送的SMS内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆