嗨,我在使用wikitude SDK(它是Cordova的增强现实插件)在Cordova项目上显示摄像机视图时遇到了麻烦。好像是在打开相机,但是一旦它开始打开,就会出现一个输入对话框,该对话框类似于在浏览器中使用命令运行应用程序时浏览器所显示的对话框。
cordova serve
问题是我在使用命令构建apk之后在真正的android设备上运行它
cordova run android
我仍然得到输入对话框
即使在android设备上运行。我已经完成了很多cordova项目,我知道它不应该在android设备上显示,而只能在浏览器上显示。单击“确定”后,所有显示它的输入对话框都会执行
alert("Ar Experience Loaded Successfully");
现在的问题是如何关闭显示感谢的输入对话框
这是我的代码:index.js
var app = {
// Url/Path to the augmented reality experience you would like to load
arExperienceUrl: "www/index.html",
// The features your augmented reality experience requires, only define the ones you really need
requiredFeatures: [ "image_tracking"],
// Represents the device capability of launching augmented reality experiences with specific features
isDeviceSupported: false,
// Additional startup settings, for now the only setting available is camera_position (back|front)
startupConfiguration:
{
"camera_position": "back"
},
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
onDeviceReady: function() {
app.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");
app.wikitudePlugin.isDeviceSupported(app.onDeviceSupported, app.onDeviceNotSupported, app.requiredFeatures);
},
// Callback if the device supports all required features
onDeviceSupported: function() {
app.wikitudePlugin.loadARchitectWorld(
app.onARExperienceLoadedSuccessful,
app.onARExperienceLoadError,
app.arExperienceUrl,
app.requiredFeatures,
app.startupConfiguration
);
},
// Callback if the device does not support all required features
onDeviceNotSupported: function(errorMessage) {
},
// Callback if your AR experience loaded successful
onARExperienceLoadedSuccessful: function(loadedURL) {
/* Respond to successful augmented reality experience loading if you need to */
alert("Ar Experience Loaded Successfully");
},
// Callback if your AR experience did not load successful
onARExperienceLoadError: function(errorMessage) {
alert(errorMessage);
}
};
app.initialize();
index.html
<!DOCTYPE html>
<html>
<head>
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Hello World</title>
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>