cordova-plugin-photo-library icon indicating copy to clipboard operation
cordova-plugin-photo-library copied to clipboard

not able to get this plugin working in ionic

Open alkahtani opened this issue 7 years ago • 12 comments

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

alkahtani avatar Jul 11 '17 16:07 alkahtani

I'm having an issue with ionic 3.

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

jdmaldonado avatar Aug 03 '17 02:08 jdmaldonado

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

alimardani avatar Oct 27 '17 23:10 alimardani

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.

syedmoosakaleem95 avatar Dec 25 '17 07:12 syedmoosakaleem95

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>

Servuc avatar Jan 10 '18 21:01 Servuc

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: [email protected]mailto:[email protected]

Please consider the environment before printing this e-mail


From: Thomas S [email protected] 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)

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

— 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.

alkahtani avatar Jan 11 '18 11:01 alkahtani

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

  • User click on button (to choose photo)
  • Loading popup is displayed
  • Loading end, viewing library page is displayed and loading hide

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 avatar Jan 11 '18 18:01 Servuc

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>

Servuc avatar Jan 11 '18 20:01 Servuc

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

alkahtani avatar Jan 11 '18 20:01 alkahtani

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 :

  • Load photos
  • When all photos load event fire, I make this.navController.push( PhotoLibraryPage, {param_photos: photos_from_fired_parameter_event

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

Servuc avatar Jan 11 '18 21:01 Servuc

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

thinhv avatar Mar 03 '18 00:03 thinhv

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

kennethross avatar Mar 13 '18 06:03 kennethross

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

eatmyball avatar May 16 '18 15:05 eatmyball