EinfachHans / cordova-plugin-contacts-x

Cordova Plugin for managing contacts
27 stars 41 forks source link

Support question: How to use this plugin with Ionic 5 #7

Closed Sunny41 closed 3 years ago

Sunny41 commented 3 years ago

Hi there,

I've wanted to use this plugin in my ionic 5 project. sadly, I couldn't find how I have to import it to my project. I use this plugin in a component.

I can't address ContactsX with window.ContactsX.xyz() and since the whole class is static, I don't know were Ionic instanciates it...

I tried to import it as you said import ContactsX from 'cordova-plugin-contacts-x'

called the pick() function like so:

ContactsX.pick(function(success){ console.log(success); }, function(error){ console.log(error); });

all I got was the error message:

undefined is not an Object.

Could you help me please? :)

EinfachHans commented 3 years ago

Please post the Output of ionic cordova plugin list

Sunny41 commented 3 years ago

Is see. It's not present there...

`call-number 0.0.2 "Cordova Call Number Plugin"

com-badrit-base64 0.2.0 "Base64"

cordova-instagram-plugin 0.5.8 "Instagram"

cordova-plugin-actionsheet 2.3.3 "ActionSheet"

cordova-plugin-advanced-http 2.4.1 "Advanced HTTP plugin"

cordova-plugin-app-version 0.1.9 "AppVersion"

cordova-plugin-badge 0.8.8 "Badge"

cordova-plugin-brightness 0.1.5 "Brightness"

cordova-plugin-camera 4.1.0 "Camera"

cordova-plugin-contacts 3.0.1 "Contacts"

cordova-plugin-datepicker 0.9.3 "DatePicker"

cordova-plugin-device 2.0.3 "Device"

cordova-plugin-dialogs 2.0.2 "Notification"

cordova-plugin-email-composer 0.9.2 "EmailComposer"

cordova-plugin-file 6.0.2 "File"

cordova-plugin-file-transfer 1.7.1 "File Transfer"

cordova-plugin-filepath 1.5.8 "cordova-plugin-filepath"

cordova-plugin-image-picker 1.1.1 "ImagePicker"

cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"

cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"

cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"

cordova-plugin-market 1.2.0 "Market"

cordova-plugin-network-information 2.0.2 "Network Information"

cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"

cordova-plugin-splashscreen 5.0.3 "Splashscreen"

cordova-plugin-statusbar 2.4.3 "StatusBar"

cordova-plugin-whitelist 1.3.4 "Whitelist"

cordova-plugin-x-socialsharing 5.6.8 "SocialSharing"

cordova-universal-clipboard 0.1.0 "Clipboard"

es6-promise-plugin 4.2.2 "Promise"

phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"

uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"

wonderpush-cordova-sdk 2.2.0 "WonderPush"

wonderpush-cordova-sdk-fcm 1.0.1 "WonderPush FCM support"`

I installed the contacts plugin with npm i cordova-plugin-contacts-x

EinfachHans commented 3 years ago

Thats not how you add Cordova Plugins^^

Run ionic cordova plugin add cordova-plugin-contacts-x

EinfachHans commented 3 years ago

Feel free to open a new issue if you have any problems

Sunny41 commented 3 years ago

thanks :) forgot this step. will come back to you ;)