cordova-plugin-contacts-phone-numbers
cordova-plugin-contacts-phone-numbers copied to clipboard
retrieving email
"If you need more fields like the email address or if you also need to retrieve the contacts without email address, we can add an option, open an issue and I'll see what I can do."
I really would appreciate the option for additional email information :)
nice plugin!
Hey @dzimmert,
I don't have time to add this feature any time soon. But if you open a PR I would be happy to merge it.
For android, it is simple, you just have to query ContactsContract.CommonDataKinds.Email.ADDRESS
, and with the cursor, check for if (mimetype.equals(ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE)) add to object
Make sure the performances are still good otherwise I won't merge it.
For ios, you can have multiple email per contacts, so you need to iterate (exactly the phone numbers), something like
ABMultiValueRef emails = ABRecordCopyValue(ref, kABPersonEmailProperty); for (CFIndex j=0; j < ABMultiValueGetCount(emails); j++) { NSString* email = (NSString*)ABMultiValueCopyValueAtIndex(emails, j); [allEmails addObject:email]; [email release]; } CFRelease(emails);
Let me know if you have some questions.
Good luck.
Hey, thanks for your reply. I managed to add emails on android. I'll try doing it for ios and will let you know if you can consider merging it :)
Hello @dzimmert,
Did you implement a fork of this upgrade ? It will be amazing to have also the photos :)
Im working on email + photos. I'll let you know when its ready ;)
@dzimmert you rock :D
Hey, i finally got some time and managed to pull emails and contact images on ios and android.
I havn't tested the performance nor is retrieving email+photos optional. I also havn't found a way to check if the images exist, so there is always an url provided, even if there is no contact photo.
So there are some things left to improve, but feel free to check this out: https://github.com/dzimmert/cordova-plugin-contacts-phone-numbers/tree/dev
Thank you ! I'm testing it !
Hi @dzimmert,
Do you have any time soon to finish your devs so we can integrate them in this repo? That'd be great.
sorry, my bad I'm testing his update right now
OK, @dbaq @dzimmert here is the tests results for Android
I have the image but not the email.
Also there is no lastName property
hello @dbaq and @dzimmert
Concerning IOS, the Cordova compliation is now impossible with the dzimmert fork.
Ld build/emulator/myApp.app/myApp normal i386
cd /Users/user/Documents/nameApp-usery/platforms/ios
export IPHONEOS_DEPLOYMENT_TARGET=6.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -L/Users/user/Documents/nameApp-usery/platforms/ios/build/emulator -F/Users/user/Documents/nameApp-usery/platforms/ios/build/emulator -FmyApp/Plugins/com.phonegap.plugins.facebookconnect -FmyApp/Plugins/cordova-plugin-webserver -FmyApp/Plugins/cordova-plugin-googleplus -filelist /Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/myApp.LinkFileList -mios-simulator-version-min=6.0 -Xlinker -objc_abi_version -Xlinker 2 -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -ObjC -fobjc-arc -fobjc-link-runtime -framework AssetsLibrary /Users/user/Documents/nameApp-usery/platforms/ios/build/emulator/libCordova.a -framework CoreGraphics -framework MobileCoreServices -framework FacebookSDK -lsqlite3 -weak_framework Social -weak_framework Accounts -weak_framework Security -framework GCDWebServer -lz -framework CFNetwork -framework SystemConfiguration -framework WebKit -weak_framework AudioToolbox -framework CoreLocation -framework GoogleOpenSource -framework GoogleSignIn -weak_framework CoreMotion -weak_framework CoreText -weak_framework MediaPlayer -weak_framework StoreKit -framework QuartzCore -weak_framework AddressBook -weak_framework AddressBookUI -Xlinker -dependency_info -Xlinker /Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/myApp_dependency_info.dat -o /Users/user/Documents/nameApp-usery/platforms/ios/build/emulator/myApp.app/myApp
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerRequest.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerURLEncodedFormRequest.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerDataRequest.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerMultiPartFormRequest.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerConnection.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerFileRequest.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerResponse.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerFileResponse.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerDataResponse.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServer.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerErrorResponse.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerStreamedResponse.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-webserver/GCDWebServer.framework/GCDWebServer(GCDWebServerFunctions.o)) nameApps built for newer iOS version (8.3) than being linked (6.0)
ld: nameApprning: object file (myApp/Plugins/cordova-plugin-googleplus/GoogleSignIn.framework/GoogleSignIn(Google.o)) nameApps built for newer iOS version (7.0) than being linked (6.0)
duplicate symbol _OBJC_CLASS_$_CDVAddressBookHelper in:
/Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/CDVContacts.o
/Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/CDVContactsPhoneNumbers.o
duplicate symbol _OBJC_METACLASS_$_CDVAddressBookHelper in:
/Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/CDVContacts.o
/Users/user/Documents/nameApp-usery/platforms/ios/build/myApp.build/Debug-iphonesimulator/myApp.build/Objects-normal/i386/CDVContactsPhoneNumbers.o
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld build/emulator/myApp.app/myApp normal i386
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/user/Documents/nameApp-usery/platforms/ios/cordova/build-debug.xcconfig,-project,myApp.xcodeproj,ARCHS=i386,-target,myApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/user/Documents/nameApp-usery/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/user/Documents/nameApp-usery/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/user/Documents/nameApp-usery/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required enviuserment or OS to build this project
Error: /Users/user/Documents/nameApp-usery/platforms/ios/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
users-Mac:nameApp-usery user$
Hey guys, sorry that my changes wont work for you. Make sure to use "dev" not "master".
Unfortunately i dont have access to a mac any more and got no time to work on it any time soon.
About the "ld: 2 duplicate symbols for architecture i386" error: I think I had to remove "contacts.m" under "build phases" > "compile sources". I also needed to readd a main source there to solve some other errors. But again, im no ios developer so I cant help you with that, sorry :(
Thanks @dzimmert, I will try to look at it soon.
thanks guys !
@dbaq any updates on email retrieval?
hey @mislavlukac, no updates, I've never received a PR. Feel free to contribute, it should be fairly easy to retrieve the email as well.
Just chiming in here... emails would be great to have!
hi @ppetree, contributions are welcome. Feel free to open a PR, I'll review it.
I don’t have a Mac. Also, since yours is a fork I suspect iOS builds are throwing depreciation warnings as a number of variables were deprecated and replaced with new objects. You may want to do a PGB build and check the iOS logs.
Sent from my iPhone
On Jan 16, 2019, at 12:53 PM, Didier Baquier [email protected] wrote:
hi @ppetree, contributions are welcome. Feel free to open a PR, I'll review it.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I also want to have this plugin with email option. I have Mac but I have no experience coding for it. I know only Python and JS.
Might I be helpful somehow?
Hello @dbaq - thank you so much for the great plugin!
I needed the email added as well, so I put up my changes here: https://bitbucket.org/BradDuell/cordova-plugin-contacts-phone-numbers-emails
Feel free to take this code and implement it in your plugin.
Thanks again for all your work on this!
Hello @BDuell: I also need the emails. Is there an npm package for it? Hello @dbaq: How would it be possible to add the thumbnail for IOS?
Thank you both for your contribution
Hello folks. First time I am adding a comment so apologies if it all goes wrong. I am using "cordova-plugin-contacts" in my app because I need to access emails, but this package has been deprecated. I would also like to access "groups" that are contained in the android contact list. My app sends invitations to meetings etc and a "group" would be a nice feature. Any chance of getting support for both emails and "groups".
Johnag