apache / cordova-plugin-contacts Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] Apache Cordova Plugin contacts
License: Apache License 2.0
[DEPRECATED] Apache Cordova Plugin contacts
License: Apache License 2.0
Now I have a problem to define whether the contacts have been updated or created. I wanted to implement the functionality of getting the updated date of the contacts in order to define whether some of the contacts has been changed. As now the Android is not giving the possibility to get the created and updated date we decided to generate hash with contact list data. So in app we can compare between the hash received from plugin and the hash received before that. By using this functionality we can understand if the contact list have been changed.
For fetching contact list in my app I need get created and updated date for each contact.
In android cordova-plugin-contacts works fine.
But In Ios this plugin does not work.
Following is my code.
cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
var rpnc=JSON.parse(window.localStorage['pb']);
var pp=[];
function onSuccess(contacts) {
var ppl=contacts.length;
for(var i=0 ;i<ppl;i++){
for(var j=0;j<contacts[i].phoneNumbers.length;j++){
if(rpnc.indexOf('+82'+contacts[i].phoneNumbers[j].value.replace(/[^0-9]/g,'').substring(1))==-1){
pp.push('+82'+contacts[i].phoneNumbers[j].value.replace(/[^0-9]/g,'').substring(1));
}
}
}
if(pp.length>0){
p_change1(pp);
var rcp=rpnc.concat(pp);
window.localStorage['pb']=JSON.stringify(rcp);
}else{
p_change2();
}
};
function onError(contactError) {
alert('onError!');
};
var options = new ContactFindOptions();
options.filter = "";
options.multiple = true;
options.desiredFields = [navigator.contacts.fieldType.id,navigator.contacts.fieldType.displayName,navigator.contacts.fieldType.phoneNumbers];
options.hasPhoneNumber = true;
var fields = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];
navigator.contacts.find(fields, onSuccess, onError, options);
}else{
alert('permission X');
}
}, function(error){
console.error("The following error occurred: "+error);
});
Device
Android 9.1 ,iOS 13.1.2
console image
Problem
Contact name is not displayed properly
This plugin crashed app android version 8 but contact is save correctly.
I have more than three address in single contact and I want to remove (delete) one of address from the list, how can I do this??
Hello
I thought when I add new contact,
it should make open native contact app from phone, than show it to user notifying that "hey! I added succesfully!"
but no way. I think there's no way of doing it...
pickContract is the one that just Open contact app not specifying certain one.
How can I open contact app with a single one
The app crashes after the permissions window appears and you click "allow." If you re-open the app, the permission is granted and you can access the contacts correctly. Has anyone else seen this or know any fixes/forks that address this?
The app will not crash after allowing contact permissions.
It crashes.
I have set the NSContactsUsageDescription in Info.plist and see that when it prompts so I know that isn't the problem. From debugging the crash log there is an error that says:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Call must be made on main thread'
I suspect this is a problem with the way the plugin is implemented not using the main thread
The pickContact
method being called for the first time in an app, causing the permissions window to appear. After accepting you should see the crash.
All iOS devices on version 14 (could have been happening earlier but I didn't notice it).
Cordova 10, cordova-plugin-contacts 3.0.1 (latest)
Finding a contact by phoneNumbers will not return the contact unless filter string is identical to contact phone number:
Example: filter: '049999111' will return contact with phone number '0499991111'
however
Example: filter: '049999111' will not return contact with phone number '04 9999 1111'
Example: filter: '04 9999 111' will not return contact with phone number '0499991111'
Example: filter: '9111' will return contact with phone number '0499991111'
however
Example: filter: '9111' will not return contact with phone number '04 9999 1111'
Since the phone number is unknown what format it will be in, the spacing should be disregarded
Cordova 7.1.0
Cordova iOS 4.5.5
iOS 12.1 iPhone X
I know this plugin is obsolete but I would like to know if anyone has ever tried to search for elements with contact.find() in a for loop on a phone number array whose names we would like to return. I have tried but the results obtained are not complete
is their any possibilities to get recent contacts from ionic cordova contacts plugin
Hi, I have an error when trying to call contacts.create.
This is the error in the console.
"Ionic Native: tried calling Contacts.create, but the Contacts plugin is not installed"
And the image is the error in the phone.
Ionic:
ionic (Ionic CLI) : 4.1.1 (C:\Users\Claudio\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 6.4.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, (and 6 other plugins)
System:
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.1.0
OS : Windows 10
and a fraction of the angular.json
"dependencies": {
"@agm/core": "^1.0.0-beta.3",
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/barcode-scanner": "^4.12.0",
"@ionic-native/contacts": "^4.12.0",
"@ionic-native/core": "~4.12.0",
"@ionic-native/in-app-browser": "^4.12.0",
"@ionic-native/splash-screen": "~4.12.0",
"@ionic-native/status-bar": "~4.12.0",
"@ionic/storage": "2.1.3",
"angular2-google-maps": "^0.17.0",
"cordova-android": "^7.1.1",
"cordova-ios": "4.5.5",
"cordova-plugin-contacts": "^3.0.1",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"phonegap-plugin-barcodescanner": "^8.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.0",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"phonegap-plugin-barcodescanner": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-contacts": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {}
I followed the documentation of the link https://ionicframework.com/docs/native/contacts but when running on the device I get the error 'NullInjectorError: No provider for Contacts!'
ERROR Error: StaticInjectorError(AppModule)[Contacts]: StaticInjectorError(Platform: core)[Contacts]: NullInjectorError: No provider for Contacts! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8895) at resolveToken (core.js:9140) at tryResolveToken (core.js:9084) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8981) at resolveToken (core.js:9140) at tryResolveToken (core.js:9084) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8981) at resolveNgModuleDep (core.js:21217) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21906) at injectInjectorOnly (core.js:1773)
`Ionic:
ionic (Ionic CLI) : 4.12.0 (C:\Users\Leandro\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.1.1
@angular-devkit/build-angular : 0.13.5
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.5
@ionic/angular-toolkit : 1.4.0
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.4
Cordova Plugins : not available
System:
Android SDK Tools : 26.1.1 (C:\Users\Leandro\AppData\Local\Android\Sdk)
NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.7.0
OS : Windows 7`
How can we create the contact to the sim card instead of the phone?
iam using ionic cordova contacts plugin ,it was working fine in android device ,but in ios device app is crashed
Hi, Im working on cordova plugin contacts. But I see there is no neighborhood filed in the address array. How Can I add Neighborhood filed in contact list.
how can I link contact like in Native Contact application?
The rationale for a best effort approach is e.g. reading up SMSs as "An SMS from Jim Smith: bla bla bla".
A method for searching for phone numbers that given any compressed number (no white space) but with or without country code provide a safe method for getting search hits.
Currently I do this, but it's not very safe:
loosify(_number.substring(3))
where loosify inserts "%" like "%1%2%3%4%". This might only work for Android, but my app is currently only for Android anyway.
We have a Samsung Galaxy S9 and it has two contacts apps. It lets us choose which app, then it shows the list of contacts, but when we select a contact, the result is "OPERATION_CANCELLED_ERROR".
More specifically, the second app is the app "Drupe". If we select a default contacts app, everything works fine.
After sync the contact to server. If i add a new contact in phone.not able to find it. Do we have any solution to find the newly add contact or last updated timestamp?
As you all know, this plugin was deprecated and no further development or bugfixing will be done. This is a major issue for everyone who uses this plugin which is a lot of people.
Now their might be a solution, but it all depends on you guys.
Capacitor is creating a list of plugins they will write and all they needs is a thumbs up from you guys to prioritize this plugin!
ionic-team/capacitor#799
What is Capacitor? Its a way to include native code into your hybrid app (a bit like cordova does but better).
Help us with your thumbs up: ionic-team/capacitor#799
While performing regression testing with the iOS 14 beta, I discovered that my app would crash when attempting to remove a contact. After doing some digging, it appears to be caused by potentially unnecessary calls dispatch_sync
.
While troubleshooting, I came upon this StackOverflow answer, which indicates that calling dispatch_sync
targeting the current queue is a no-no. Through debugging my app, I discovered that this is indeed the scenario under which my app was crashing. It does not appear to crash on devices with iOS 13.
I believe I confirmed the source of the problem by changing the code in CDVContacts.m
(createAddressBook
) from
dispatch_sync(dispatch_get_main_queue(), ^{
if (error) {
workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
} else if (!granted) {
workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:PERMISSION_DENIED_ERROR]);
} else {
// access granted
workerBlock(addressBook, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
}
});
to
dispatch_block_t onMain = ^{
if (error) {
workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
} else if (!granted) {
workerBlock(NULL, [[CDVAddressBookAccessError alloc] initWithCode:PERMISSION_DENIED_ERROR]);
} else {
// access granted
workerBlock(addressBook, [[CDVAddressBookAccessError alloc] initWithCode:UNKNOWN_ERROR]);
}
};
if ([NSThread isMainThread]) {
onMain();
} else {
// callback can occur in background, address book must be accessed on thread it was created on
dispatch_sync(dispatch_get_main_queue(), onMain);
}
After I made this change locally and re-ran the app, the contact was successfully removed.
Contact.remove
from @ionic-native/contacts
crashed on iPad Pro: iPadOS 14 beta 2
did not crash on iPhoone XS iOS 13.6
Cordova: 9
cordova-ios: 5.1.1
cordova-plugin-contacts: 3.0.1
Ionic: 3
@ionic-native/contacts: 4.1.0
Im trying to save a contact which works for most information but if I try to add an URL to the contact it just ignores the update without an error.
For example:
contact.urls.push(new ContactField("SomeValue", "http://www.example.com"))
console.log(contact)
let result = await contact.save()
console.log(result)
Print before save():
... "urls":[{"type":"SomeValue","value":"http://www.example.com"}] ...
After contact.save():
... "urls":null ...
Any idea why my input is ignored?
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{1daa3c0 5625:{packname}/u0a508} (pid=5625, uid=10508) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4287)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:5672)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2278)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1533)
at android.content.ContentResolver.query(ContentResolver.java:518)
at android.content.ContentResolver.query(ContentResolver.java:475)
at org.apache.cordova.contacts.ContactAccessorSdk5.search(ContactAccessorSdk5.java:196)
at org.apache.cordova.contacts.ContactManager$3.run(ContactManager.java:209)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:760)
Some people say that it is a sdk problem, there are corresponding programs, but I will not develop Android, so I can't understand how to modify it.
This problem occurs in the miui system, which is the Chinese Android custom system for Xiaomi.
The following is the corresponding solution I found, but after the tutorial is modified, the compiler package will report an error, I think there is a problem with the method or what jar package is missing.
https://blog.csdn.net/OREO_GO/article/details/52295099
https://blog.csdn.net/waww116529/article/details/77719531
As we are creating the phone contact manger module, we want to set users profile picture.
As currently we are able to store all users details but we are not able to store the contact photo, my code is as follows:
contact.photos= [new ContactField('photo', this.tempProfilepic)];
where tempProfilePic is filePath URL, also I tried with base64 as well but nothing worked,
Might be the solution already available but I am not able to find it out properly.
Thanks in advance.
During creating contact on Samsung S8(Android version 8.0.0) App crashes
warning: AddressBook is deprecated. Consider migrating to Contacts instead.
warning: AddressBookUI is deprecated. Consider migrating to ContactsUI instead
when I'm go to build for ios device showing AddressBook is deprecated how to resolve it ?
i have a app. from that app we can add ,remove and update contact in phone system when i try to create contact it is working but when i try to update contact it is keep crashing app . i aslo add read and write permission in save and remove but solution is still not work
I try update one contact on my phone by call save() method.But after update i refresh my contact on phone.It was empty.Please hep me!
I was wondering what happens if Apple forces users to use the newer SDK from XCode 10. Do we still get these deprecation notices or cant we use this existing plugin anymore starting from Match?
let options = new ContactFindOptions();
options.filter='';
options.hasPhoneNumber=true;
options.multiple=true;
let contact:Contact[];
this.contacts.find(["displayName","phoneNumbers"],options).then((cont)=>{
contact=cont
})
Ionic:
ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.1
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 14 other plugins)
System:
ios-deploy : 2.0.0
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS
Xcode : Xcode 9.4.1 Build version 9F2000
Error:
vendor.js:1774 ERROR TypeError: Cannot read property 'split' of undefined
at get (vendor.js:71544)
at getPlugin (vendor.js:71576)
at checkAvailability (vendor.js:112501)
at vendor.js:72133
at Contacts.find (vendor.js:72140)
at OrderPage.webpackJsonp.390.OrderPage.ionViewDidLoad (main.js:1729)
at ViewController._lifecycle (vendor.js:22559)
at ViewController._didLoad (vendor.js:22442)
at Tab.NavControllerBase._didLoad (vendor.js:55759)
at t.invoke (polyfills.js:3)
Contact with birthday, which is without year imports with empty birthday
Expects to have contact with birthday with empty year
We have contact with empty birthday
This problem is because date without year in android passed as "--MM-DD"(https://stackoverflow.com/questions/25161485/is-the-mm-dd-format-for-month-day-part-of-iso-8601), which cannot parse by Date.valueOf
method.
Reproduced on Android 26 Pixel Emulator
Imported contact with custom label should display 'label'
Imported contact with custom label displayed as '$!!$'
Look at the label 'school'
Testing.vcf.zip
Stackoverflow Thread on similar issue
iOS 13
I conduct contact.save() twice on android.
contact1 and contact2 are the same expect that they have different comany name.
I expect to get two contact on my phone, which is contact1 and contact2.
I only get contact1 on my phone.
But on IOS, I actually get two contacts.
I am using cordova-plugin-contacts of version "2.3.1"
Can someone help?
Hi,
When I try to assign this :
new ContactName(null, 'Smith', 'John');
into contact.name :
let contact: Contact = this.contacts.create();
let usuario = new ContactName(null, 'Smith', 'John');
console.log(typeof usuario)
contact.name = new ContactName(null, 'Smith', 'John'); <-- failure occurs here
contact.phoneNumbers = [new ContactField("mobile","6471234567")];
contact.save().then(
() => console.log("Contact saved!", contact),
(error: any) => console.error("Error saving contact.", error)
);
}
I get an error:
ERROR TypeError: Cannot set property 'name' of undefined
at Contact.set [as name] (decorators.js:195)
at HomePage.add (home.ts:85)
at Object.eval [as handleEvent] (HomePage.html:191)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLButtonElement. (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
I im indeed importing :
import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
Into the page that I want to use it, and I'm importing the contacts into the constructor.
Also I'm adding into providers the
import { Contacts} from '@ionic-native/contacts';
and I have installed :
$ ionic cordova plugin add cordova-plugin-contacts
$ npm install --save @ionic-native/contacts
I think when importing data from device all contacts also saved in app-local storage.
How can I get new contact list ?
In iphone6,2 , device version : 12.1
contact permission is not getting..
In iOS 13 I am not able to retrieve the note field.
I am able to see the note field, but not able to read it.
Does anyboday has a fix for this problem that seems only to occur for iOS 13?
Someone can help me. How to update an existing contacts ?
Please support me ! When i call save() method to modify contact.It was sccucess.But i notify ,after that access to contact lists on phone it was very slow .How can i fix it ?
Not able to get the image to work, receive below error in chrome debug:
Not allowed to load local resource : content://com.android.contacts/contacts/8/photo
also tried application here but no success, https://github.com/janpio/ionic-native-contacts
also noticed someone had same issue but got resolved by removing the webview plugin, But I require that plugin #165
code:
getContacts() {
this.contacts.find(
["displayName", "phoneNumbers","photos"],
{multiple: true, hasPhoneNumber: true}
).then((contacts) => {
for (var i=0 ; i < contacts.length; i++){
if(contacts[i].displayName !== null) {
var contact = {};
contact["name"] = contacts[i].displayName;
contact["number"] = contacts[i].phoneNumbers[0].value;
if(contacts[i].photos != null) {
console.log(contacts[i].photos);
contact["image"] = this.sanitizer.bypassSecurityTrustUrl(contacts[i].photos[0].value);
console.log(contact);
} else {
contact["image"] = "assets/dummy-profile-pic.png";
}
this.contactList.push(contact);
}
}
});
}
my ionic info:
$ ionic info
✔ Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.13
@angular-devkit/build-angular : 0.8.6
@angular-devkit/schematics : 0.8.6
@angular/cli : 6.2.6
@ionic/angular-toolkit : 1.0.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 10 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/me/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 6.3.0
OS : macOS
Xcode : Xcode 10.0 Build version 10A255
and package.json
{
"name": "test",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~6.1.1",
"@angular/core": "~6.1.1",
"@angular/forms": "~6.1.1",
"@angular/http": "~6.1.1",
"@angular/platform-browser": "~6.1.1",
"@angular/platform-browser-dynamic": "~6.1.1",
"@angular/router": "~6.1.1",
"@ionic-native/base64": "^5.0.0-beta.21",
"@ionic-native/camera": "^5.0.0-beta.21",
"@ionic-native/contacts": "^5.0.0-beta.21",
"@ionic-native/core": "5.0.0-beta.21",
"@ionic-native/diagnostic": "^5.0.0-beta.21",
"@ionic-native/fcm": "^5.0.0-beta.21",
"@ionic-native/ionic-webview": "^5.0.0-beta.21",
"@ionic-native/native-storage": "^5.0.0-beta.21",
"@ionic-native/network": "^5.0.0-beta.21",
"@ionic-native/splash-screen": "5.0.0-beta.21",
"@ionic-native/sqlite": "^5.0.0-beta.21",
"@ionic-native/status-bar": "5.0.0-beta.21",
"@ionic/angular": "4.0.0-beta.13",
"@ionic/pro": "2.0.3",
"com-badrit-base64": "^0.2.0",
"cordova-android": "7.0.0",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-contacts": "^3.0.1",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^2.2.6",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.2.0",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^2.5.0",
"cordova.plugins.diagnostic": "^4.0.10",
"core-js": "^2.5.3",
"rxjs": "6.2.2",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/architect": "~0.8.5",
"@angular-devkit/build-angular": "~0.8.5",
"@angular-devkit/core": "~0.8.5",
"@angular-devkit/schematics": "~0.8.5",
"@angular/cli": "~6.2.5",
"@angular/compiler": "~6.1.1",
"@angular/compiler-cli": "~6.1.1",
"@angular/language-service": "~6.1.1",
"@ionic/angular-toolkit": "^1.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.0",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~2.9.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-contacts": {},
"cordova-plugin-camera": {},
"cordova-plugin-fcm-with-dependecy-updated": {},
"cordova-plugin-nativestorage": {},
"cordova-plugin-network-information": {},
"cordova-sqlite-storage": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova.plugins.diagnostic": {},
"com-badrit-base64": {},
"cordova-plugin-ionic-webview": {}
},
"platforms": [
"android"
]
}
}
When I try to save the new contact in Android 9, the App crash always after insert the contact. There is permissions for READ and WRITE in AndroidManifest.xml
Here, the code:
var myContact = navigator.contacts.create({
displayName: 'Test',
phoneNumbers: [{
'type' : 'phone',
'value' : '99999999'
}],
emails: [{
'type': 'email',
'value': '[email protected]'
}]
});
myContact.save();
The code is very simple and save the contact perfectly in my Android phone, but the problem is that the App Crash after save.
Anyone know what the problem may be and could you help me ??
Thanks.
I am facing the issue on Android and IOS both platform that. If the user has a large number of the contact. The phone is stuck and time taking on load contact. Is any other way that I can get only updated or new added contact from the phone book.
I tried updating contact information on iOS using the plugin and it worked for strings but once I tried to modify array types, it was actually just ignored in the update.
After searching a bit further, I noticed that when I did put a breakpoint in the ios code, it worked but when removing that breakpoint again, it failed. Which made me conclude that its some kind of race condition.
Now I wonder if this issue is Ionic related or not. Not that Ionic does a lot with the contacts itself, it basically just allows Typescripting etc.
Anyone using this plugin with Ionic which notices the same issues?
There is some days that i search a solution to my problem.
I use the Ionic Contacts plugin ( https://ionicframework.com/docs/native/contacts/ ) and i need to get the photos of my contact list. In iOS it work but in android it won't.
I tried to sanitize,normalizeURL, and all that i found on the internet but it won't work.
Here's my code ;
home.ts
userPhoto: any;
getContacts() {
this.contacts.find(['displayName', 'name', 'phoneNumbers', 'emails', 'photos'], {filter: "", multiple: true})
.then(data => {
console.table(data[0]);
this.userName = data[0].displayName;
this.userPhoto = this.sanitizer.bypassSecurityTrustUrl(data[0].photos[0].value);
});
}
home.html
<button ion-button (click)="getContacts()">Get contacts</button>
<p>Nom : {{ userName }}</p>
<hr />
<img [src]="userPhoto" style="width: 100px;">
The error that i got in Chrome inspector:
Not allowed to load local resource: content://com.android.contacts/contacts/1/photo
Does you have any solution ?
Thanks you,
Dylan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.