2016-09-22 4 views
1

このプラグイン "Phonegap-SMS-reception-plugin"を使用しましたが、コマンドプロンプトまたは手動でインストールできません。 これ以外のOTPを検出するプラグインは見つかりませんでした。ハイブリッドモバイルアプリからSMSのデータを取得できません。cordovaプラグインを使用してOTPを検出する方法

答えて

3

このプラグインにはファイルがありません。この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> 

アプリはマシュマロで付与されたSMSの許可を読んだことを確認し使用してください。

関連する問題