Phonegap Build: cordova-plugin-contacts not loading - cordova-plugins

I am facing issues with my contacts plugin for last few days. While building application using PGB the contacts plugin is getting listed under plugin tab. But, while doing chrome inspect for my App, it is not getting loaded under android_assets/www/plugins folder. Due to which while trying to create object ContactFindOptions() under deviceready() ,I am facing Uncaught ReferenceError. Can someone please help. I have tested this on Android 5.1.1 and 6.0.1
Below are the screenshots.
PGB Plugins tab
Chrome Inspect Error and folder structure
config.xml
<!-- Core plugins -->
<plugin name="cordova-plugin-contacts" source="npm" />
<plugin name="cordova-plugin-calendar" source="npm" />
<plugin name="cordova-plugin-device" source="npm" />
<plugin name="cordova-plugin-globalization" source="npm" />
<plugin name="cordova-plugin-dialogs" source="npm" />
<plugin name="phonegap-plugin-push" spec="1.4.5" source="npm">
<param name="SENDER_ID" value=“##########” />
</plugin>

Got the solution.
The error is shown in the PGB log. Here, the latest version of cordova-plugin-contacts (3.0.1) is not compatible with PGB version (cli-6.5.0 Android 6.1.2), so need to downgrade the plugin.
spec="2.3.1" of cordova-plugin-contacts is compatible with cli-6.5.o of PGB.

Related

Ship google-services.json with ionic package builds

Since I do not have Mac and iPhone, the only option for me is to use Ionic Cloud to build my native binaries. However, first I wanted to play with it and see how will it work with android builds.
My application uses https://github.com/fechanique/cordova-plugin-fcm
So I can build application with ionic cordova build android and run it on my emulator without any problems. However if I execute ionic package build android and then ionic package info I get message that my build FAILED.
Examine this failure with ionic package BUILD_ID I get this message:
Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.
So, looks like that my google-services.json does not get uploaded to the cloud. So searching I find few posts of people that had same problem but none of them provided me with solution. I also found this:
https://cordova.apache.org/docs/en/latest/config_ref/index.html#resource-file
So I have tried to tell to ionic to include this google-services.json file with package like this:
<?xml version='1.0' encoding='utf-8'?>
<widget id="me.citybeep.partnerapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<!-- ... -->
<platform name="android">
<!-- ... -->
<resource-file src="google-services.json" target="platforms/android/google-services.json" />
</platform>
<!-- ... -->
<engine name="android" spec="^6.2.3" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-fcm" spec="^2.1.2" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-sqlite-storage" spec="^2.0.4" />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="^0.8.5" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>
And also tried this:
<resource-file src="google-services.json" target="google-services.json" />
But we no success, however now I get another message:
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: me.citybeep.partnerapp
Name: City_Beep_Partner
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android#6.2.3
Error: Source path does not exist: google-services.json
I think this error is just that google-services.json did not get uploaded.
I am really dependent now on this plugin and using Ionic Push notifications is not an options at the moment...
So is there any way to tell ionic to include this google-services.json file when uploading to the cloud (and also .plist file). And I repeat, it is not problem with google-services.json file or my firebase project as everything works fine while performing build on my machine.
i tried several solutions, but the only one worked for me was specifying src and target with relative path of the google-services.json.
In your case change
<resource-file src="google-services.json" target="platforms/android/google-services.json" />
to
<resource-file src="platforms/android/google-services.json" target="platforms/android/google-services.json" />
this should work.

iOS10 cordova-camera-roll crashes app

Newest iOS 10.2, Phonegap build crashes with cordova-camera-roll version 0.2.1 plugin.
Using Phonegap version cli-6.3.0
<preference name="phonegap-version" value="cli-6.3.0" />
Looks like the new plugin cordova-plugin-ios-camera-permissions and cordova-plugin-ios-microphone-permissions solves the issue.
<plugin name="cordova-plugin-ios-camera-permissions" spec="1.0.3" />
https://www.npmjs.com/package/cordova-plugin-ios-camera-permissions
<plugin name="cordova-plugin-ios-microphone-permissions" spec="1.0.0" />
https://github.com/pinchnzoom/cordova-plugin-ios-microphone-permissions

ionic cant get network connection consistently - when building for ios/android platform

I just cant consistently get a network connection for my ionic app on my ios device. It works sometimes with the reset, remove&add platforms but recently it just doesnt work. Im trying it over 10 times already. Its crazy.
How do i get network working consistently on ionic ? (cordova-plugin-network-information)
Im using ionic version 1.7.14
I'ved tried several ways like
ionic state reset
or
ionic platform remove ios
ionic platform add ios
I'ved got this error:
Error: undefined is not an object (evaluating 'navigator.connection.type')
in my config.xml, here are my plugins.
<plugin name="cordova-plugin-device" spec="~1.1.1" />
<plugin name="cordova-plugin-network-information" spec="~1.2.0" />
<plugin name="cordova-plugin-image-picker" spec="https://github.com/wymsee/cordova-imagePicker.git" />
<plugin name="cordova-plugin-whitelist" spec="~1.2.1" />
<plugin name="cordova-plugin-console" spec="~1.0.2" />
<plugin name="cordova-plugin-file-transfer" spec="~1.5.0" />
<plugin name="com.raananw.imageResizer" spec="https://github.com/RaananW/PhoneGap-Image-Resizer" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.2.0" />
<plugin name="ionic-plugin-keyboard" spec="~2.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="~3.1.0" />
<plugin name="cordova-plugin-camera" spec="~2.1.1" />
<plugin name="cordova-plugin-actionsheet" spec="https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git" />
<plugin name="cordova-plugin-app-version" spec="https://github.com/whiteoctober/cordova-plugin-app-version.git" />
<plugin name="onesignal-cordova-plugin" spec="~1.12.5" />

ios phonegap plugin from a static library

I have a iOS custom phonegap plugin packaged as a iOS static library. When I try to include this library in any other phonegap project, I am getting the PHONEGAP error on my console:
ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml
As suggested, I am suspecting the config.xml is to be blamed. I wanted to know how/what is the right way of referencing an iOS plugin class (which is inside a static library) in the config.xml
Current implementation:
eg:
<feature name="CustomPlugin">
<param name="ios-package" value="CustomPlugin"/>
</feature>
where the static library included is libCustomPlugin.a(containing object ~ CustomPlugin.o) and the header is CustomPlugin.h
Thanks in advance
For me on PhoneGap 2.7.0 I have a config.xml with something like:
<plugins>
<plugin name="Accelerometer" value="CDVAccelerometer"/>
<plugin name="Battery" value="CDVBattery"/>
<plugin name="Camera" value="CDVCamera"/>
<plugin name="Capture" value="CDVCapture"/>
<plugin name="Compass" value="CDVLocation"/>
<plugin name="Contacts" value="CDVContacts"/>
<plugin name="Debug Console" value="CDVDebugConsole"/>
<plugin name="Device" value="CDVDevice"/>
<plugin name="Echo" value="CDVEcho"/>
<plugin name="File" value="CDVFile"/>
<plugin name="FileTransfer" value="CDVFileTransfer"/>
<plugin name="Geolocation" value="CDVLocation"/>
<plugin name="Logger" value="CDVLogger"/>
<plugin name="Media" value="CDVSound"/>
<plugin name="NetworkStatus" value="CDVConnection"/>
<plugin name="Notification" value="CDVNotification"/>
<plugin name="SplashScreen" value="CDVSplashScreen"/>
<plugin name="InAppBrowser" value="CDVInAppBrowser"/>
</plugins>
Your project is complaining because the "Device" plugin can't be found - it is a standard PhoneGap (Cordova) plugin which will be required by your project. So not connected to any custom plugins.

Xcode PhoneGap navigator.connection Undefined

Trying to port my PhoneGap javascript code into Xcode for debugging in iOS.
Using Cordova-3.0.0.
When I call:
navigator.connection.type
I am getting an 'undefined' for navigator.connection.
Did I not include the network connection plugin correctly in my config.xml, or is something else amiss? Yes, I included the correct cordova.js file specifically for iOS. Yes, deviceready has been fired.
Update: I am currently only running this on the iOS emulator.
My config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.app.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
Description
</description>
<author email="dev#callback.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<plugins>
<plugin name="NetworkStatus" value="CDVConnection" />
</plugins>
</widget>
Thank you for your help!
Been doing my research on this one, and finally came up with the solution.
Apparently PhoneGap (Adobe) recently updated their documentation, and filled in a lot of the holes I was running into for Phonegap 3.0.0
1) To do this using the command-line interface, you have to have git installed to be able to run those commands. Get git here.
2) They added to the Connection plugin documentation to use the following command-line interface commands to add the plugin to the project:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
$ cordova plugin rm org.apache.cordova.core.network-information
3) They updated the declaration in the config.xml file to the following (for iOS):
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
If you simply want to know if you are connected or not try using navigator.onLine in your js instead. Works for me on IOS 8 & Android 2.3 and doesn't require any plugins

Resources