我正在尝试使用Android中的手机间隙运行Camera API,我正在运行所有类型的问题.
我刚刚复制了phonegap相机的例子.
我收到以下错误
07-12 18:18:00.706: E/Web Console(17837): Uncaught TypeError: Cannot read property 'SAVEDPHOTOALBUM' of undefined at file:///android_asset/www/index.html:98
07-12 18:17:59.456: E/Web Console(17837): Uncaught ReferenceError: Camera is not defined at file:///android_asset/www/index.html:67
Run Code Online (Sandbox Code Playgroud)
我尝试了所有其他目的地类型.它起作用了
destinationType: destinationType.FILE_URI
destinationType: Camera.DestinationType.FILE_URI
destinationType: destinationType.DATA_URL
Run Code Online (Sandbox Code Playgroud)
我还添加了相机和硬件相机权限的许可.但它仍然失败了
以下是以下内容
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
// Wait for PhoneGap to connect with the device
//
document.addEventListener("deviceready",onDeviceReady,false);
// PhoneGap is …Run Code Online (Sandbox Code Playgroud) 情景
我有一个小的Android Phonegap/Cordova 2.3.0应用程序,我查看了/res/xml/config.xml文件,发现那里有很多插件.
这是一个非常小的应用程序,我想,我正在使用的是通知和ChildBrowser插件.
问题:我想知道删除所有其他插件条目是否安全.如果是,那么:
1)只从/res/xml/config.xml中删除它们吗?
2)哪些插件是强制性的(没有哪个插件不起作用)?例如,第一个("App"插件),我认为是必需的?
3)删除插件会增加我的应用程序的速度吗?或者更小的安装尺寸或.apk尺寸.
有关详细信息,这是我的XML文件的一部分:
<plugins>
<plugin name="App" value="org.apache.cordova.App"/>
<plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
<plugin name="Device" value="org.apache.cordova.Device"/>
<plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
<plugin name="Compass" value="org.apache.cordova.CompassListener"/>
<plugin name="Media" value="org.apache.cordova.AudioHandler"/>
<plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
<plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
<plugin name="File" value="org.apache.cordova.FileUtils"/>
<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
<plugin name="Notification" value="org.apache.cordova.Notification"/>
<plugin name="Storage" value="org.apache.cordova.Storage"/>
<plugin name="Temperature" value="org.apache.cordova.TempListener"/>
<plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
<plugin name="Capture" value="org.apache.cordova.Capture"/>
<plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
<plugin name="Echo" value="org.apache.cordova.Echo" />
<plugin name="StatusBarNotification" value="com.phonegap.plugins.statusBarNotification.StatusBarNotification"/>
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"/>
<plugin name="ChildBrowser" value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
<plugin name="PushNotification" value="com.pushwoosh.plugin.pushnotifications.PushNotifications" onload="true"> …Run Code Online (Sandbox Code Playgroud) 我做了一个项目,在那里我建立了一个从我的蓝牙插件到我的javascript的成功通信.从我的Javascript我在java中注册回调到我的插件:
if (action.equals(ACTION_REGISTER_CALLBACK)) {
if(mJSCallback != null) {
pluginResult = new PluginResult(PluginResult.Status.ERROR, "An event callback has already been registered.");
} else {
mJSCallback = callbackId;
pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
pluginResult.setKeepCallback(true);
}
}
Run Code Online (Sandbox Code Playgroud)
这当然是在exec函数中完成的.因为事实上,蓝牙事件并非在某些时间点,我注册了一个广播接收器,它发送消息到我的javascript,例如当找到设备时.
if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
sendMessagetoJSCallback(new PluginResult(PluginResult.Status.OK, "Discovery finished."));
}
Run Code Online (Sandbox Code Playgroud)
发送所属的功能:
public void sendMessagetoJSCallback(PluginResult res) {
res.setKeepCallback(true);
success(res, mJSCallback);
}
Run Code Online (Sandbox Code Playgroud)
我在那个上下文中真正理解的是,setKeepCallback在那些不同的函数中做了什么.我以为会有文档,但没有.
有人能告诉我吗?我在https://github.com/phonegap/phonegap-plugins/tree/master/Android/PhoneListener上定位开发
当我尝试启动inappbrowser时,我不断收到以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8000/cordova_plugins.js
Run Code Online (Sandbox Code Playgroud)
当我查找"cordova/platforms/android/assets/www/cordova_plugins.js"时,文件确实丢失了.
奇怪的是我看到:
Writing out cordova_plugins.js...
Run Code Online (Sandbox Code Playgroud)
我的构建过程如下所示:
cordova create cordova com.myapp.mobile myapp
cd cordova
cordova platform add android
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
cordova build
cordova serve android
Run Code Online (Sandbox Code Playgroud) 使用Cordova版本3.x和Android版本2.x到4.x.
我想知道:
window.sqlite.openDatabase()函数包装器是window.openDatabase()什么?我一整天都在寻找答案,Google-sphere没有提供任何答案.我已经尝试了所有我知道如何做的事情,并通过建议的解决方案和答案工作,没有任何工作.
概括地说,我试图建立一个Phonegap用于应用程序Android和Apple移动设备和我需要的功能之一是同时检测网络状态和网络连接的类型.以下是我正在使用的代码.
该Firing device ready警报火灾关闭,然后我得到的错误Cannot read property 'type' of undefined,然后通过的循环Navigator对象.当我浏览对象的每个属性时,我没有看到旧版本中使用的connection属性甚至network属性.
有人有主意吗?
的index.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- jQuery Core -->
<script src="js/jquery-1.11.1.min.js"></script>
<!-- The main engine for the software. -->
<script src="js/main.js"></script>
<!-- Third party plugins -->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="barcodescanner.js"></script>
<script type="text/javascript" src="childbrowser.js"></script>
<script type="text/javascript" src="js/barcode.js"></script>
<title>index</title>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
</script>
</head>
<body>
<script>
barcode_app.initialize();
</script> …Run Code Online (Sandbox Code Playgroud) 我想开发PhoneGap应用程序,所以我试图使用此链接中提到的过程 在窗口上安装cordova .
1. Node.js
2. git client
3. npm install npm -g
我使用上面的步骤3,(请参阅参考资料)摆脱这个警告,没有成功
4 npm install -g cordova
但我得到了以下警告.
C:\>npm install -g cordova
npm WARN engine cordova-js@3.8.0: wanted: {"node":"~0.10.x"} (current: {"node":"
0.12.0","npm":"2.5.1"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.12.0","npm":"2.5.1"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {
"node":"0.12.0","npm":"2.5.1"})
C:\Users\Neelabh\AppData\Roaming\npm\cordova -> C:\Users\Neelabh\AppData\Roaming
\npm\node_modules\cordova\bin\cordova
cordova@4.3.0 C:\Users\Neelabh\AppData\Roaming\npm\node_modules\cordova
??? underscore@1.7.0
??? q@1.0.1
??? nopt@3.0.1 (abbrev@1.0.5)
??? cordova-lib@4.3.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.
2.3, bplist-parser@0.0.6, mime@1.2.11, …Run Code Online (Sandbox Code Playgroud) 我有一个phonegap/cordova应用程序,我想用Precise Biometric的智能卡Tactivo阅读器保护.我是智能卡集成的新手,而精确生物识别技术似乎没有非常丰富的文档.但是我发现我需要为phonegap创建自己的插件才能使用读卡器.
我的问题是:是否已经为此创建了一个插件,或者有人发布了我需要的插件代码示例?
到目前为止,我在plugin.xml文件中有这个代码:
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-device"
version="1.0.0-dev">
<name>smartCard</name>
<description>Cordova smartCard Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,smartCard</keywords>
<repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git</repo>
<issue>https://issues.apache.org/jira/browse/CB/component/12320648</issue>
<js-module src="www/smartCard.js" name="smartCard">
<clobbers target="smartCard" />
</js-module>
...
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="smartCard" >
<param name="android-package" value="org.apache.cordova.smartCard.SMARDCARD"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="com.precisebiometrics.android.mtk.manager.permission.BIOMETRIC_DATA" />
</config-file>
<source-file src="src/android/smartCard.java" target-dir="src/org/apache/cordova/smartCard" />
<js-module src="www/smartCardHandle.js" name="smartCardHandle">
<clobbers target="smartCardrHandle" />
</js-module>
</platform>
Run Code Online (Sandbox Code Playgroud)
www/*.js文件中没有代码
我只想指出正确的方向.谢谢.
如何在同一个phonegap应用程序中显示Pdf文件.我试过Inappbrowser,Mupdf,PDFJS所有正在使用其他pdf viewer显示PDF.我想在同一个应用程序中打开pdf文件.任何人都可以帮助我.谢谢你提前
我目前正在尝试将照片上传到我的Apache Cordova应用中的Firebase应用存储中.我目前使用以下代码获取照片的URI:
function getPhotoFromAlbum() {
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 50,
sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM,
destinationType: navigator.camera.DestinationType.FILE_URI
});
}
function onPhotoURISuccess(imageURI) {
var image = document.getElementById('image');
image.style.display = 'block';
image.src = imageURI;
getFileEntry(imageURI);
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试将图像转换为文件并使用以下函数将其推送到我的Firebase存储:
function getFileEntry(imgUri) {
window.resolveLocalFileSystemURL(imgUri, function success(fileEntry) {
console.log("got file: " + fileEntry.fullPath);
var filename = "test.jpg";
var storageRef = firebase.storage().ref('/images/' + filename);
var uploadTask = storageRef.put(fileEntry);
}, function () {
// If don't get the FileEntry (which may happen when testing
// on some emulators), copy to a …Run Code Online (Sandbox Code Playgroud) javascript phonegap-plugins cordova firebase firebase-storage
cordova ×10
phonegap-plugins ×10
android ×6
javascript ×2
cordova-3 ×1
firebase ×1
ios ×1
node.js ×1
pdf-viewer ×1
performance ×1
smartcard ×1
sqlite ×1
web-sql ×1