Skip to content

fix(camera): throw error if no activity to pick images is found - #668

Merged
jcesarmobile merged 3 commits into
ionic-team:mainfrom
zuckey-m:fix-photo-activity-not-found
Oct 26, 2021
Merged

fix(camera): throw error if no activity to pick images is found#668
jcesarmobile merged 3 commits into
ionic-team:mainfrom
zuckey-m:fix-photo-activity-not-found

Conversation

@zuckey-m

@zuckey-m zuckey-m commented Oct 25, 2021

Copy link
Copy Markdown
Contributor

if Activity is not found, do not call com.getcapacitor.Plugin.startActivityForResult at CameraPlugin openPhotos and reject.

closes #667

@jcesarmobile jcesarmobile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sadly Google put some restrictions on resolveActivity on Android 11 and this change makes the picking images impossible on Android 11 devices as resolveActivity is always returning false.

Can you try using try catch to catch the activity not found error instead of this?

Also, would be helpful if you could provide some way of reproducing this, all my devices have a gallery app that can't be uninstalled.

@zuckey-m

Copy link
Copy Markdown
Contributor Author

@jcesarmobile

thx for your comment.
i use try-catch instead of resolveActivity .

on my own two devices, i could uninstall gallery app.
and it seems that this logic works correctly on these devices.

two devices spec is below:

Model Android OS version
ASUS ZenPad 10 (Z301MFL) 7
arrows Be F-04K 9

@jcesarmobile jcesarmobile changed the title fix(camera): if Activity is not found, do not call startActivityForResult fix(camera): throw error if no activity to pick images is found Oct 26, 2021
@jcesarmobile
jcesarmobile merged commit 00a18ee into ionic-team:main Oct 26, 2021
@zuckey-m
zuckey-m deleted the fix-photo-activity-not-found branch October 27, 2021 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug(CameraPlugin, Android) - crash when getPhoto() is called but gallery apps are not found.

3 participants