Adding Dialogs Plugin to phonegap project prevents deviceReady from Firing - android

I started using phonegap but as a beginner i ran into many problems.
one of the latest is problem with adding plugins
I added plugin of dialogs
org.apache.cordova.dialogs
with command line tool and it added successfully . but after running application in android emulator it never fire deviceReady Event. before adding plugin it was OK.
as a note I should say I installed older versions of plugin but they didn't work either !

Well I found the answer , I was building my project with phonegap but installed cordova plugins , I create a new project with command
cordova create project [folder name] [namespace "like com.example.appname"]
[project name]
and it worked correctly after that and I installed plugins as usual .

Related

Capacitor Quasar "Geolocation" plugin is not implemented on android

I added capacitor via the quasar framework. I didn't add any plugin at first and everything worked perfectly. Then I updgraded to capacitor v3. I followed the guide and my app worked also without any problems. Then I added the geolocation plugin to capacitor. It works as expected in the browser, but when I try it on my native android device it gives me this error:
"Geolocation" plugin is not implemented on android
It looks like I didn't install the plugin, but as I said, it works in the browser.
Ok fixed it, by checking both package.json files (also the one in /src-capacitor). I used capacitor 3 in my web project but capacitor 2 in my capacitor project. I wanted to use v3 so I tried to access the plugin in the way of capacitor v3 which did not work.
This is because Capacitor changes the underlying Gradle files but Android Studio doesn't know.
To fix this, go to Android studio click File -> Sync Project with Gradle Files

PhoneGap build fails after plugin install

I installed this phonegap plugin: https://github.com/cranberrygame/phonegap-plugin-ad-admob
cordova plugin add com.cranberrygame.phonegap.plugin.ad.admob
but now my build now fails even after I remove it.
export ANDROID_HOME=/var/lib/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
phonegap build android
here is the result:
http://pastebin.com/ZdJw3izm
this happened after installing a different plugin but was fixed after installing some extras for android like the billing library ect. but they are still installed...
I have fixed this myself by creating a new project and copying the code over, but im not sure how to mark this question as answered...

Unable to use cordova plugin from github in Intel XDK

I am trying to add cordova plugin at https://github.com/dbaq/cordova-plugin-contacts-phone-numbers in Intel XDK thrid-party plugins. I have given plugin id at com.dbaq.cordova.contactsPhoneNumbers and Repo URl as https://github.com/dbaq/cordova-plugin-contacts-phone-numbers.git but even after bulding the whole project for android, when I use navigator.contactsPhoneNumbers.list after deviceReady event, I get "Cannot read property 'list' of undefined". Is there anything, I am missing. Same thing happens with other cordova plugins located on Github like Cordova CallNumberPlugin located at github.com/Rohfosho/CordovaCallNumberPlugin.
Note that, I have tested the build on android phone but still no success.

Debugging custom CordovaPlugin

This is my first question here.
I am using Cordova 3.4.0-0.1.3 and would like to write a custom Android plugin. After some tutorials, I have managed to call my custom plugin from my Cordova app by executing "cordova run android" command. The app starts and with my remote debug console I can see my own "Hello world" message from my own Cordova plugin.
The next thing I would like to do is debugging my plugin in Eclipse.
The first thing I tried was to launch the app from Eclipse by executing the AndroidManifest.xml located in the /cordovaproject/platforms/android/ folder.
After the app was launched, the following javascript errors i get in my remote console:
deviceready has not fired after 5 seconds. cordova.js:1128
Channel not fired: onNativeReady cordova.js:1121
Channel not fired: onPluginsReady cordova.js:1121
Channel not fired: onCordovaReady cordova.js:1121
It look likes there are Cordova components that aren't loading when you directly run the app in Eclipse.
This error does not occur when I deploy the app with "cordova run android".
My question is:
How can I properly run/debug my Cordova plugin in Eclipse?
I have fixed my problem. The problem was that I added the android plugin by "Import existing project".
The correct way to add the Cordova android project in Eclipse is to create an new "Android Application project" with existing sources.
When you do this, the referenced CordovaLib project is also found by Eclipse.

phonegap - navigator.connection.type not defined

I am trying to check for an established network connection through the phonegap/cordova API, but alas, it is not working.
I added the plugin as explained on the cordova documentation, and phonegap local plugin list gives [phonegap] org.apache.cordova.network-information.
However, simply calling
document.addEventListener("deviceready", function () {
alert(Object.keys(navigator.connection));
}, false);
results on my phone (Android 4.0.4) always returning 0 and running on an emulator with Android 4.4.2 logs into LogCat that navigator.connection is undefined. In fact, on both machines alert(Object.keys(navigator)); never shows the connection key.
Any solution?
Phonegap with Cordova 3.3.0
When you install the plugin it copies files to www/plugins and updates android.json
then when you build the project, the build copies the java to platforms/android/src/... and the js files to platforms\android\assets\www\plugins (and does any customisation defined in plugin.xml)
At multiple occasions I saw android.json not correctly updated and javascript files not copied. Removing and re-installing plugins solved the problem for me.
If you did not perform manual customisations to the platforms/android folder, I think the easiest way to clean your project would be to empty the /plugins folder and the platforms folder and then re-install all the plugins you need.
I had the same issue and found I had to run "cordova build" and then the status was returned correctly.
BEWARE
When I run cordova build, it appears to take everything in my ~/app/www directory and overried everything in app/platforms/android/assets/www/
My "install process" is as follows:
cordova create app com.app "App"
cd app
cordova platform add android
cordova plugin add org.apache.cordova.network-information
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.geolocation
cordova build
I can then do code changes in app/www and when happy, 'deploy' it using 'cordova build' (which seems to always copy the files to app/platforms/android/assets/www/.
If I add another plugin using: (for example)
cordova plugin add org.apache.cordova.file
then I need to run
cordova build
to have it work.
I hope this helps
(I am using cordova 3.3.1-0.1.2 )

Categories

Resources