[英]why i am not getting OTP SMS when using verifyPhoneNumber method of ionic 3 cordova native plugin?
[英]how to detect OTP using cordova plugin
我已經使用了此插件“ Phonegap-SMS-reception-plugin”,但無法從命令提示符或手動安裝它。 除此之外,我找不到其他任何插件來檢測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>
確保該應用程序已讀取棉花糖中授予的短信權限。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.