cordova-plugins

How to test custom cordova plugin's native code?

允我心安 提交于 2019-12-06 07:23:15
问题 I know cordova-plugin-test-framework will help in testing any cordova project. I am developing a custom camera cordova plugin for Android platform. I would like to write some Junit/Instrumentation test cases for my custom camera Android plugin code. I am facing issues as I can't create CordovaInterface , CordovaWebView Objects from my test class. Is there anyway that I can create CordovaInterface , CordovaWebView Objects from my test class and pass these as parameters for my custom camera

Request Permission in Android Cordova plugin does not prompt the user

一个人想着一个人 提交于 2019-12-06 06:14:29
问题 I am trying to write a Cordova Plugin to have a Facebook chat head like floating icon for ionic hybrid apps which requires SYSTEM_ALERT_WINDOW Permission. Since Android M onward requires the user to grant the permission at the first time the app starts, I am trying to use Cordova plugin's cordova.requestPermission(CordovaPlugin plugin, int requestCode, String permission) method to prompt the user to grant permission (as in the documentation). public class Floatie extends CordovaPlugin {

Cordova 3.5 deviceready event not fired after 5 seconds

ⅰ亾dé卋堺 提交于 2019-12-06 06:14:19
问题 I recently upgraded my cordova app from cordova v2.9 to v3.5.0. After adding plugins from command-line, I imported my app to eclipse so that I can test on an android device. But, when I run the app, I see below logcat message: 07-08 11:24:03.359: I/Web Console(1500): deviceready has not fired after 5 seconds. at file:///android_asset/www/cordova/cordova.js:1154 07-08 11:24:03.359: D/CordovaLog(1500): file:///android_asset/www/cordova/cordova.js: Line 1147 : Channel not fired:

Get selected file size using org.apache.cordova.file

烂漫一生 提交于 2019-12-06 06:03:25
Using org.apache.cordova.file plugin I can selected the file and I get the native path of the file. After that I have to restrict the user to select the file according to there file size. But I can't get that file size . My problem is that I can't get the file Size using that plugin. For this I am using this tutorial. To get file size, you need to access it via metadata as follows: window.resolveLocalFileSystemURL(filePath, function (fileSystem) { fileSystem.getFile(fileName, {create: false}, function (fileEntry) { fileEntry.getMetadata( function (metadata) { alert(metadata.size); // get file

Ionic: Opening html content in Inapp Browser

一个人想着一个人 提交于 2019-12-06 05:37:44
I'm trying to integrate payment gateway in an Ionic mobile app. I get the HTML code from the server which contains a form with all the post parameters and submit on page load to call the payment gateway. How can I open the in-app browser with the HTML content? After the transaction, the payment gateway will call the server URL & process the response. How can I now communicate back to Ionic app to close In-app browser & show the response? Check out the exceuteScript Api of the Cordova In-App-Browser plugin. You should be able to Add the required HTML to an empty document Poll the document

How to upload saved video to a remote server, captured using cordovaCapture?

无人久伴 提交于 2019-12-06 05:35:12
问题 I am using the captureVideo method of cordovaCapture as follows: $cordovaCapture.captureVideo(options) .then(function(videoData) { var file_path = videoData[0].fullPath; // upload to server }); I get the file path as file:/storage/....mp4 How to upload this file to a remote server, will I be able to access this file directly through my controller or will I have to process a url out of it? I am using the Ionic framework. Any help would be much appreciated. 回答1: It is pretty simple. This will

What thread to use for Cordova plugin callback?

筅森魡賤 提交于 2019-12-06 05:13:28
问题 In what thread are the methods of CallbackContext supposed to be called? The documentation for CordovaPlugin#execute(...) says it's called in the WebView thread. Is that the same as the UI thread? If so, then that's probably my answer. If the WebView thread is not the UI thread, and I'm supposed to call back in the WebView thread, is it possible to do so asynchronously? 回答1: I put you the Threading section of the android plugins documentation. The plugins are all asynch, when you call them

How to use custom Cordova plugin methods in Angular/Ionic service

我们两清 提交于 2019-12-06 04:18:49
问题 I'm working on integrating a custom Cordova plugin into an Ionic app. We had a 3rd party create a Cordova plugin to interface with a bluetooth device. Running cordova platform ls shows the plugin has been correctly installed: $ cordova plugin ls > com.sitename.product 0.0.0 "DeviceProbe" The plugin contains a probe.js file containing methods for connecting, reading, polling and other actions. /plugins/com.sitename.product/www/probe.js var callNative = function(service, action, success, error,

accessing android internal storage with cordova file plugin

余生颓废 提交于 2019-12-06 04:04:32
问题 I'm trying to make an android app that, so far, is using the native voice recorder to record audio. The path for that is the Sounds file in /storage/emulated/0/Sounds Now the app is using the File Transfer cordova plugin. The root for that is /data/data/thisAppDirectory and requestFileSystem is using this as the path. Is it possible to go up a directory with the file system to get to the sounds folder? 回答1: Yes here we go! You have to utilize cordova file-transfer plugin, like so: window

Cordova's FileTransfer Writing Error (Code 1)

一曲冷凌霜 提交于 2019-12-06 03:41:41
问题 I'm using Cordova 4.2.0 for Android. I have some troubles to get FileTransfer plugin work properly. I suppose that there is a writing error exception:".myApp\/contentImages\/20150110220101.jpg: open failed: ENOENT (No such file or directory)" filename was previously tested and does not exist yet: rootFS.getFile('.myApp/contentImages/'+file,{create:false}, function(){ console.log(file+' already exists'); }, function(error){ console.log(file+" does not exist locally"); console.log("Error #"