Ionic 3 - Can't get android contact photo
See original GitHub issueThere 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
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to get contacts images Ionic 3 - angular - Stack Overflow
import { DomSanitizer } from '@angular/platform-browser';. Define Component Class method sanitizeImage(value){ return this.sanitizer.
Read more >Image not displaying while displaying contacts - Ionic Forum
it is trying to fetch the image as that box is visible only in contacts which have photo,but its not able to display...
Read more >Ionic Native: Accessing iOS Photos and Android Gallery, Part I
In today's post, we'll take a look at the first of two ways to easily get images from the Gallery on Android and...
Read more >Camera Capacitor Plugin API
The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.
Read more >Camera and Image picker in Ionic 5 apps - Enappd
Step 3 — Use Camera / Image Picker Plugin In App ; DATA_URL · FILE_URI · Return file uri (content://media/external/images/media/2 for Android). NATIVE_URI,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello,
Thanks you it effectively was the cordova-plugin-ionic-webview plugin, when i removed it it worked !
Thanks you ou saved me a lot of time 👍
Dylan
yup i also tried everything but img is not display