1
我已經使用這個插件「Phonegap-SMS-reception-plugin」,但我無法從命令提示符或手動安裝它。 除此之外,我找不到任何其他插件用於檢測OTP並從混合移動應用程序的短信中獲取數據如何檢測使用科爾多瓦插件的OTP
我已經使用這個插件「Phonegap-SMS-reception-plugin」,但我無法從命令提示符或手動安裝它。 除此之外,我找不到任何其他插件用於檢測OTP並從混合移動應用程序的短信中獲取數據如何檢測使用科爾多瓦插件的OTP
該插件中缺少一些文件。使用此cordova-plugin-sms
<script type="text/javascript">
var body = "";
var address = "";
$(document).ready(function() {
if((/(ipad|iphone|ipod|android)/i.test(navigator.userAgent))) {
document.addEventListener('deviceready', initApp, false);
} else {
alert('need run on mobile device for full functionalities.');
}
});
function startWatch() { // start listening incoming sms
if(SMS) SMS.startWatch(function(){
alert('watching', 'watching started');
}, function(){
alert('failed to start watching');
});
}
function stopWatch() { // stop listening incoming sms
if(SMS) SMS.stopWatch(function(){
update('watching', 'watching stopped');
}, function(){
updateStatus('failed to stop watching');
});
}
function initApp() {
if (! SMS) { alert('SMS plugin not ready'); return; }
document.addEventListener('onSMSArrive', function(e){
var sms = e.data;
body = sms.body;
address = sms.address;
});
}
</script>
確保應用程序已經閱讀棉花糖授予短信的權限。