Skip to content

Application Crash On Android #343

Answered by yasirkula
pmeet862 asked this question in Q&A
Mar 22, 2025 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

I'm suspecting that synchronous RequestPermission inside GetImageFromGallery is causing this issue. Can you replace your code as follows and try again:

public async void SelectPhotoFromGallery()
{
	// Ask permission asynchronously
	if (await NativeGallery.RequestPermissionAsync(NativeGallery.PermissionType.Read,NativeGallery.MediaType.Image) != NativeGallery.Permission.Granted)
		return;

	NativeGallery.GetImageFromGallery((path) =>
	{
		...
	});
}

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@pmeet862
Comment options

@yasirkula
Comment options

@pmeet862
Comment options

@yasirkula
Comment options

Answer selected by pmeet862
Comment options

You must be logged in to vote
1 reply
@yasirkula
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants