2016-09-22 3 views

답변

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를 읽기 권한이 있는지 확인하십시오.

관련 문제