cordova-plugin-contacts-phone-numbers icon indicating copy to clipboard operation
cordova-plugin-contacts-phone-numbers copied to clipboard

retrieving email

Open danni-san opened this issue 9 years ago • 24 comments

"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!

danni-san avatar Sep 23 '15 10:09 danni-san

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.

dbaq avatar Sep 25 '15 03:09 dbaq

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 :)

danni-san avatar Sep 25 '15 14:09 danni-san

Hello @dzimmert,

Did you implement a fork of this upgrade ? It will be amazing to have also the photos :)

ronycohen avatar Sep 26 '15 11:09 ronycohen

Im working on email + photos. I'll let you know when its ready ;)

danni-san avatar Sep 28 '15 08:09 danni-san

@dzimmert you rock :D

ronycohen avatar Sep 28 '15 09:09 ronycohen

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

danni-san avatar Oct 09 '15 13:10 danni-san

Thank you ! I'm testing it !

ronycohen avatar Oct 09 '15 23:10 ronycohen

Hi @dzimmert,

Do you have any time soon to finish your devs so we can integrate them in this repo? That'd be great.

dbaq avatar Oct 17 '15 19:10 dbaq

sorry, my bad I'm testing his update right now

ronycohen avatar Oct 18 '15 14:10 ronycohen

OK, @dbaq @dzimmert here is the tests results for Android

image

I have the image but not the email.

ronycohen avatar Oct 18 '15 16:10 ronycohen

Also there is no lastName property

ronycohen avatar Oct 18 '15 17:10 ronycohen

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$ 

ronycohen avatar Oct 19 '15 15:10 ronycohen

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 :(

danni-san avatar Oct 19 '15 16:10 danni-san

Thanks @dzimmert, I will try to look at it soon.

dbaq avatar Oct 19 '15 16:10 dbaq

thanks guys !

ronycohen avatar Oct 19 '15 19:10 ronycohen

@dbaq any updates on email retrieval?

mislavlukach avatar Mar 03 '17 13:03 mislavlukach

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.

dbaq avatar Mar 03 '17 18:03 dbaq

Just chiming in here... emails would be great to have!

ppetree avatar Jan 16 '19 17:01 ppetree

hi @ppetree, contributions are welcome. Feel free to open a PR, I'll review it.

dbaq avatar Jan 16 '19 17:01 dbaq

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.

ppetree avatar Jan 16 '19 19:01 ppetree

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?

minimedj avatar Mar 16 '19 09:03 minimedj

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!

BDuell avatar Aug 19 '19 06:08 BDuell

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

Ebioro avatar Oct 17 '19 09:10 Ebioro

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

johnagar avatar Apr 04 '20 10:04 johnagar