2013-11-15 5 views
1

스트레이트 요점.아파치 코르도바 장치 .uuid

Apache Cordova 3.1.0을 사용하여 Android 휴대 전화 용 device.uuid를 다운로드하려고합니다.

cordova-android/bin/create mobile-client 

샘플 응용 프로그램이 잘 작동 :

나는 코르도바를 사용하여 샘플 추가를 만들었습니다. 다음 코드를 추가하여 장치를 uuid로 설정합니다.

다음
TypeError: Cannot read property 'uuid' from undefined 

내 자바 스크립트입니다 :

그러나 나는 다음과 같은 오류가 그냥 실행 앱이 에 장치 플러그인을 추가 할 필요가

var app = { 
    initialize: function() { 
     this.bindEvents(); 
    }, 
    bindEvents: function() { 
     document.addEventListener('deviceready', this.onDeviceReady, false); 
    }, 
    onDeviceReady: function() { 
     app.receivedEvent('deviceready'); 
    }, 
    receivedEvent: function (id) { 
     var parentElement = document.getElementById(id); 
     var listeningElement = parentElement.querySelector('.listening'); 
     var receivedElement = parentElement.querySelector('.received'); 

     listeningElement.setAttribute('style', 'display:none;'); 
     receivedElement.setAttribute('style', 'display:block;'); 

     console.log('Received Event: ' + id); 

     try { 
      alert(device.uuid); 
     } catch (e) { 
      alert(e); 
     } 

    } 
}; 

답변

0

cordova plugin add --save cordova-plugin-device 
관련 문제