cordova-plugins

How to unit test a cordova plugin using Junit?

北战南征 提交于 2019-12-08 19:10:32
I've done some Cordova plugins and I would like to write unit tests on it. The idea is that, after I run cordova build android, for example, the test files would be moved to the correct folder on Android and I could run tests with Java. Is that possible? I've seen some plugins to make possible to test a Cordova plugin, like cordova plugin test framework. The problem here is that it only tests the call and the callback. It's not possible to mock objects, for example. For instance, I have a plugin to track GPS and I would like to test it. I also would like to test the iOS side as well. You were

How to run cordova music player in background with options available on notification bar

℡╲_俬逩灬. 提交于 2019-12-08 17:13:58
问题 I am building music player application for android phone using cordova media plugin. With the help of plugin i am able to play the local music now i wants to add a feature that even if the application is closed by the user. Music player should run in background with play,pause,exit options available in notification bar. Can any one help me in this case. Thanks in advance 回答1: I'm using this plugin here, and it works for me on android: https://github.com/homerours/cordova-music-controls-plugin

SQLite plugin for Cordova: Code running backwards

拈花ヽ惹草 提交于 2019-12-08 13:56:31
I'm new using Cordova and Mobile development in general, but I have a really strange behavior in my code. I'm using the SQLite plugin with ngCordova (I'm using Ionic) and what I want to do is very simple: If a table exist, then drop it or create if it doesn't exists. I've created a service for the database operations (I don't know if is the best way to do it, but it keeps that kind of logic separated from controllers). The logic is this: app.js angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter.services']) .run(function($ionicPlatform, $ionicLoading, $timeout,

Why does cordova-plugin-nativestorage work on browser but not on phone

£可爱£侵袭症+ 提交于 2019-12-08 13:30:50
I am using the Phonegap CLI to serve my project and my plugin version is: 2.3.1 So, I wrote the following code to execute after the device is ready: NativeStorage.getItem("abcd",function(){ console.log("success");alert("success"); },function(){ console.log("fail");alert("failed :)"); }); This works perfectly when I am testing it on my browser. However, when I open this app on my android phone, the NativeStorage code does not work at all. I used weinre to debug my app: I got the error: ReferenceError: NativeStorage is not defined I also removed the plugin and all the platforms and reinstalled

Cordova camera plugin to create half screen for camera and other half for selection menu

吃可爱长大的小学妹 提交于 2019-12-08 09:23:44
问题 I am a trying to implement Instagram like camera interface(half screen is camera and other haalf is selection menu) using cordova camera plugin. Can anybody help me with this? Couldn't find a good source 回答1: You need to implement an hybrid view, check this article. I did it to implement a, JAVA SurfaceView (implementing the camera inside it) over a CordovaWebView. To give you some direction: In the JavaScript for your plugin have something like: SurfaceViewAdd:function(){ cordova.exec(

Cordova permissions requires android.permission.READ_CONTACTS, or grantUriPermission()

二次信任 提交于 2019-12-08 08:28:35
问题 I'm using Cordova 5.3.1 When i use contactsprovider.PickContact, it returns the following error Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/raw_contacts from pid=7739, uid=10141 requires android.permission.READ_CONTACTS, or grantUriPermission() My androidmanifest.xml is: <?xml version='1.0' encoding='utf-8'?> <manifest android:hardwareAccelerated="true" android:versionCode="100009"

Add PhoneGap app to “share” menu on Android and IOS

╄→尐↘猪︶ㄣ 提交于 2019-12-08 07:42:39
问题 I am wondering whether it is possible to add my PhoneGap application to android and ios "share" screens. This is basically what i am talking about: User is on Chrome and wants to share a particular page url Instead of copying the link into the clipboard and manually running the app, the user can select the "share" option and choose my application from the list I am using PhoneGap Build service to build my application. I have been searching online and here on StackOverflow and there are plugin

Why does cordova-plugin-nativestorage work on browser but not on phone

笑着哭i 提交于 2019-12-08 07:14:54
问题 I am using the Phonegap CLI to serve my project and my plugin version is: 2.3.1 So, I wrote the following code to execute after the device is ready: NativeStorage.getItem("abcd",function(){ console.log("success");alert("success"); },function(){ console.log("fail");alert("failed :)"); }); This works perfectly when I am testing it on my browser. However, when I open this app on my android phone, the NativeStorage code does not work at all. I used weinre to debug my app: I got the error:

Cannot read the property 'type' of undefined error in cordova network plugin

左心房为你撑大大i 提交于 2019-12-08 06:46:01
问题 I am developing android application using cordova and ionic framework,using network plugin from here (https://github.com/apache/cordova-plugin-network-information). But the device ready alert fires off and then I get the the following error. "TypeError: Cannot read property 'type' of undefined Here is navigator object navigator.connection.type I will get error in following line. 回答1: use mine document.addEventListener("deviceready", onDeviceReady, false); // Cordova is ready function

SQLite plugin for Cordova: Code running backwards

孤街浪徒 提交于 2019-12-08 06:33:14
问题 I'm new using Cordova and Mobile development in general, but I have a really strange behavior in my code. I'm using the SQLite plugin with ngCordova (I'm using Ionic) and what I want to do is very simple: If a table exist, then drop it or create if it doesn't exists. I've created a service for the database operations (I don't know if is the best way to do it, but it keeps that kind of logic separated from controllers). The logic is this: app.js angular.module('starter', ['ionic', 'ngCordova',