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



[ Full content available at: 
https://github.com/apache/cordova-plugin-contacts/issues/165 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to