Cordova 如何获取Cordovo navigator对象而不是javascript navigator对象?

Cordova 如何获取Cordovo navigator对象而不是javascript navigator对象?,cordova,phonegap-plugins,Cordova,Phonegap Plugins,我对科尔多瓦很陌生。我正在尝试创建一个简单的应用程序,用户可以在其中拍照,然后将照片显示在html图像标记中 我遇到了一些问题,我发现很难解决: (1) 首先,在android上运行此演示移动应用程序时 navigator.camera.getPicture(onSucess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.PictureSourceType

我对科尔多瓦很陌生。我正在尝试创建一个简单的应用程序,用户可以在其中拍照,然后将照片显示在html图像标记中

我遇到了一些问题,我发现很难解决:

(1) 首先,在android上运行此演示移动应用程序时

 navigator.camera.getPicture(onSucess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
navigator.camera正在重新调整null。这是因为浏览器将navigator对象引用到javascript navigator对象,而不是cordova对象。我怎样才能解决这个问题

(2) 在VisualStudio中的android emulator上运行时,我在尝试使用imageUri分配给时遇到以下错误

代码:


错误:无法加载资源:数据:图像/jpeg;base64,blob:http%3A//localhost%3A4400/c78426c3-2f0e-4b9a-955c-df0005519358加载资源失败:net::ERR_无效_URL

如果有人也遇到此问题,我会通过在main index.html中添加对cordova.js的引用来修复此问题

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">    
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <title>Audit Chamber</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/javascript" src="cordova.js"></script>
  </body>
</html>

审计分庭

嘿,确保设备准备就绪后使用navigator.camera。导航器在DeviceRady事件后可用。我尝试过了,见上面的代码,没有运气
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">    
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <title>Audit Chamber</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/javascript" src="cordova.js"></script>
  </body>
</html>