我按照 Wikitude 中的 POI 示例创建了一个简单的应用程序。当我运行应用程序时,相机视图上没有绘制任何标记。我对示例 POI 应用程序也有同样的问题。onLocationChangedFn
我已经在 ' ' 和 ' ' 函数内的 js 文件中放置了一些 JS 警报,createMarkerAtLocation
并且警报正确显示(希望这意味着 javascript 函数被正确调用。但标记仍然没有显示在地理位置.
我在 Eclipse 的 logcat 中看到以下内容:
09-21 11:32:50.809: D/dalvikvm(6108): GC_FOR_ALLOC freed 1255K, 29% free 8947K/12551K, paused 18ms, total 19ms
09-21 11:32:50.839: D/dalvikvm(6108): GC_CONCURRENT freed 15K, 24% free 9561K/12551K, paused 12ms+3ms, total 33ms
09-21 11:32:50.849: E/deviceSupported(6108): true
09-21 11:32:50.849: I/ArchitectWebView(6108): ARchitect Build: d4452f2
09-21 11:32:50.919: D/dalvikvm(6108): GC_CONCURRENT freed 561K, 22% free 9826K/12551K, paused 12ms+2ms, total 33ms
09-21 11:32:50.919: D/dalvikvm(6108): WAIT_FOR_CONCURRENT_GC blocked 9ms
09-21 11:32:50.939: D/dalvikvm(6108): GC_FOR_ALLOC freed 733K, 21% free 9920K/12551K, paused 17ms, total 17ms
09-21 11:32:50.969: D/dalvikvm(6108): GC_CONCURRENT freed 608K, 20% free 10147K/12551K, paused 12ms+2ms, total 30ms
09-21 11:32:50.969: D/dalvikvm(6108): WAIT_FOR_CONCURRENT_GC blocked 17ms
09-21 11:32:51.049: E/Web Console(6108): Uncaught ReferenceError: AR is not defined at null:1
09-21 11:32:51.109: I/Adreno200-EGL(6108): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: Nondeterministic AU_msm8625_REFS/TAGS/JB_REL_RB5_QRD_D20130228_CL3285357_release_AU (CL3285357)
09-21 11:32:51.109: I/Adreno200-EGL(6108): Build Date: 03/01/13 Fri
09-21 11:32:51.109: I/Adreno200-EGL(6108): Local Branch:
09-21 11:32:51.109: I/Adreno200-EGL(6108): Remote Branch: m/refs/tags/jb_rel_rb5_qrd_D20130228
09-21 11:32:51.109: I/Adreno200-EGL(6108): Local Patches: NONE
09-21 11:32:51.109: I/Adreno200-EGL(6108): Reconstruct Branch: NOTHING
09-21 11:32:51.179: E/libEGL(6108): called unimplemented OpenGL ES API
09-21 11:32:51.179: W/Adreno200-ES20(6108): <qgl2DrvAPI_glHint:90>: GL_INVALID_ENUM
09-21 11:32:51.179: E/libEGL(6108): called unimplemented OpenGL ES API
09-21 11:32:52.289: D/dalvikvm(6108): GC_FOR_ALLOC freed 1121K, 23% free 9784K/12551K, paused 19ms, total 22ms
09-21 11:32:52.949: E/BufferQueue(6108): [unnamed-6108-1] dequeueBuffer: mMinUndequeuedBuffers=2 exceeded (dequeued=6)
09-21 11:32:52.949: I/Choreographer(6108): Skipped 109 frames! The application may be doing too much work on its main thread.
09-21 11:32:52.979: E/BufferQueue(6108): [unnamed-6108-1] dequeueBuffer: mMinUndequeuedBuffers=2 exceeded (dequeued=5)
09-21 11:32:55.139: D/dalvikvm(6108): GC_FOR_ALLOC freed 867K, 25% free 9523K/12551K, paused 24ms, total 24ms
09-21 11:32:55.199: D/dalvikvm(6108): GC_CONCURRENT freed 8K, 22% free 10918K/13959K, paused 12ms+5ms, total 47ms
09-21 11:33:08.909: E/Web Console(6108): Uncaught TypeError: Property 'onLocationChanged' of object [object Object] is not a function at null:1
09-21 11:33:08.909: E/Web Console(6108): Uncaught TypeError: Property 'onLocationChanged' of object [object Object] is not a function at null:1
我在上面的日志中看到了两个问题:一个关于 the "unimplemented OpenGL ES API"
,另一个关于"Uncaught TypeError: Property 'onLocationChanged' "
这些是标记没有出现的原因吗?我该如何解决这些问题并在屏幕上显示标记。请帮忙 ...
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="target-densitydpi=device-dpi, width = 540, user-scalable = 0" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="architect://architect.js"></script>
<script type="text/javascript" src="ade.js"></script>
<script>
<!-- Javascript function defining a click handler -->
function messageClicked() {
// set the message DIV text
document.getElementById("messageElement").innerHTML = "My text";
}
</script>
<style type="text/css">
/* CSS Style for the message DIV that displays our message */
.message {
border-radius: 2em;
border: solid 1px #6d6d6d;
background-color: rgba(255,255,255,0.5);
color: black;
text-align: center;
position:absolute;
width: 50%;
height: 10%;
left: 25%;
top: 45%;
}
}
</style>
</head>
<body class="custom">
<div id="messageElement" class="message" onClick="messageClicked();">
Hello World!
</div>
<script>
AR.context.onLocationChanged = function(lat, lon, alt, acc) {
// the current location's latitude, longitude, altitude and accuracy
// are passed in by the ARchitect
var myGeoLocation = new AR.RelativeLocation(null, 10, 0, 0);
var myCircle = new AR.Circle(5, {style: {fillColor: '#FFC100'}});
var myGeoObject = new AR.GeoObject(myGeoLocation, {drawables: {cam: myCircle}});
//AR.context.onLocationChanged = null;
// Hide loading message
//document.getElementById("messageElement").style.display="none";
}
</script>
</body>