Android 기기 (Samsung Galaxy S II)에서 PhoneGap을 처음 실행하려고합니다. 그러나, 그것은 작동하지 않는 것 같습니다.PhoneGap이 Android에서 실행되지 않음
여기 코드는 지금까지 시도 :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"
/>
<title>Hello World</title>
<script type="text/javascript" src="cordova-2.2.0.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var options = new ContactFindOptions();
options.filter = "";
options.multiple = true;
var filter = ["displayName"];
navigator.contacts.find(filter, onSuccess, onError, options);
}
function onSuccess(contacts) {
for(var i = 0; i < contacts.length; ++i) {
alert(contacts[i].displayName);
}
alert("OK then");
console.log("OK");
}
function onError(contactError) {
alert("onError!");
console.log("Fail");
}
</script>
</head>
<body >
</body>
<h1> Example </h1>
<p> Find Contacts </p>
</html>
아무것도 쇼 업! 경고도없고, 로그도없고 단지 body
이상의 HTML 페이지 만 표시합니다.
@Edit : 결과를 표시합니다. 그러나 모든 결과는 null
이며 Alert
대화 상자에 나타납니다. 누구든지이 경험이 있습니까?
귀하의 'contacts.length'은 무엇입니까? –
@PratikSharma : 발견 된 연락처 수. 내 전화는'693'이지만, 모든 displayName은'null'입니다. 다음과 같이 'null'이되어서는 안됩니다. http://docs.phonegap.com/en/2.2.0/cordova_contacts_contacts.md.html#Contact –
알림을 'contacts [i] .name .givenName' 그리고 아직도 그 null을 참조하십시오? –