terikon / cordova-plugin-photo-library

Maintainer needed. Please contact if you're using this library in your project
MIT License
149 stars 296 forks source link

not able to get this plugin working in ionic #71

Open alkahtani opened 6 years ago

alkahtani commented 6 years ago

i need help please , can anyone tell me how to get this plugin working or refer me to an working example please .

jdmaldonado commented 6 years ago

I'm having an issue with ionic 3.

this.photoLibrary.requestAuthorization() It never show the pop up, to give access.

alimardani commented 6 years ago

I have the same problem. this.photoLibrary.requestAuthorization() is not showing a pop up on ios 11.It always goes to catch block

this.photoLibrary.requestAuthorization().then(() => {
            this.photoLibrary.getLibrary().subscribe({
                next: library => {
                    library.forEach(function (libraryItem) {
                        console.log(libraryItem.photoURL);  
                    });
                },
                error: err => {
                    console.log('could not get photos');
                },
                complete: () => {
                    console.log('done getting photos');
                }
            });
        }).catch(err => {
                console.log('permissions weren\'t granted');
            });

Also on the android 4.4.2 it loads all the photos without asking permission. Is there anybody knows the reason?

Thanks

syedmoosakaleem95 commented 6 years ago

Hey, I have the same problem with this.photoLibrary.requestAuthorization() and it is not allowing permissions, I'm running my App on Ionic DevApp to download images to PhotoLibrary, please help me to fix this issue.

Servuc commented 6 years ago

Hey :)

For my self, it was a miss parameter in my config.xml (ionic 2). Then it works fine on iOS (after ionic cordova platform update ios <-- I'm not really sure, it was 4 month ago)

<?xml version='1.0' encoding='utf-8'?>
<widget id="fr.juks.app" version="1.0.10" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <!-- some data -->

    <plugin name="cordova-plugin-photo-library" spec="^2.1.0">
        <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="To choose photos for profile or after your runs" />

    </plugin>
</widget>
alkahtani commented 6 years ago

Thank you, this really helpful , it seems the plugin take long time to read photos and some times the view is displayed blank ,especially if you have long list of photos in your device

Mohammed Al-kahtani

IT Projects Specialist, Information Technology

Masila Petroleum Exploration and Production Company (PetroMasila) P.O. Box 52137

Central Processing Facility Mukalla, Yemen

T: +967-5-332-166 Ext. 3600:: F: +967-5-332-694:: M:+967-712600013: E: Al-kahtani_Mohammed@PetroMasila.commailto:Al-kahtani_Mohammed@PetroMasila.com

Please consider the environment before printing this e-mail


From: Thomas S notifications@github.com Sent: Wednesday, January 10, 2018 9:40:29 PM To: terikon/cordova-plugin-photo-library Cc: alkahtani; Author Subject: Re: [terikon/cordova-plugin-photo-library] not able to get this plugin working in ionic (#71)

Hey :)

For my self, it was a miss parameter in my config.xml (ionic 2)

<?xml version='1.0' encoding='utf-8'?>

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/terikon/cordova-plugin-photo-library/issues/71#issuecomment-356745597, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AM4JaK-dS6Dn-aknB97V1G2U02ME3qWoks5tJS5NgaJpZM4OUgrS.

Servuc commented 6 years ago

Yes I view it to. For my self, I choose a simple solution to prevent that :

I will test soon to display photos 10 by 10 to test if retrieve them is more powerfull :)

The button is only a function call that make a copy sub array of original photos array.

I will leave a feedback soon about that ;)

Servuc commented 6 years ago

Little update :)

I've check to display only 10 by 10 photos, It's better :D

this.photos = this.originalPhotosArray.splice(0, 10); 
// change 0 and 10 on button clicked

My HTML :

<div *ngFor="let photo of photos>
    <img [src]="photo.thumbnailURL" />
</div>
alkahtani commented 6 years ago

i tried to have all the image in DOM and then read 10 by 10 it works great but the problem in the first load , since it reads all the photos

Servuc commented 6 years ago

For my self, photos load only if I set app down (background, not exit) and I re-open it (foreground).

So my solution, this is not very good but it works :

On page A :

On page B ( PhotoLibraryPage ), in constructor, I just use this.navParams.get("param_photos")

thinhv commented 6 years ago

I got into the same issue. On iOS 11 this.photoLibrary.requestAuthorization() always throws an error.

kennethross commented 6 years ago

Same here. this.photoLibrary.requestAuthorization() throwing an error.

eatmyball commented 6 years ago

I have same issue too. It's any update here?