Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Camera Permission on Android 9.0 hangs #165

Open
ChrisKrause opened this issue Feb 6, 2020 · 1 comment
Open

Camera Permission on Android 9.0 hangs #165

ChrisKrause opened this issue Feb 6, 2020 · 1 comment

Comments

@ChrisKrause
Copy link

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 5.0.0
Device Tested On: Android Emulator, Samsung A20 and Samsung A7 (2018)
Simulator Tested On: Android Simulator from Visual studio
Version of VS: 2019 version 16.4.4
Version of Xamarin: 16.4.00.309
Versions of other things you are using:
Xamarin.Android.SDK 10.1.3.7

Steps to reproduce the Behavior

Android forms app
Request camera permission

Expected Behavior

Camera permission set and application continues

Actual Behavior

Camera permission is set but application hangs

Code snippet

       ```

var status = await CrossPermissions.Current.CheckPermissionStatusAsync();
if (status != PermissionStatus.Granted)
{
await CrossPermissions.Current.RequestPermissionAsync();
status = await CrossPermissions.Current.CheckPermissionStatusAsync();
}

Debugger shows call stack :
 	```
0xFFFFFFFFFFFFFFFF in System.Diagnostics.Debugger.Mono_UnhandledException_internal	C#
 	0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:120,4	C#
 	0x20 in Android.Runtime.DynamicMethodNameCounter.44	C#
 	0x12 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:157,13	C#
 	0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0 at /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021,49	C#
 	0xC in Android.App.SyncContext.	C#
 	0xE in Java.Lang.Thread.RunnableImplementor.Run	C#
 	0xA in Java.Lang.IRunnableInvoker.n_Run	C#
 	0x11 in Android.Runtime.DynamicMethodNameCounter.44	C#

Screenshots

No

None to show

Note:
I am using the Media Plugin v4.4.10 and that uses the Permissions plugin.

These permission requests work ok: MediaLibrary, Storage, and Location

If you restart the app after the crash the permissions was actually set and the app works fine.

@vukwilku
Copy link

vukwilku commented Apr 27, 2020

Same problem here. My Code:

Page code
public SamplePage()
{
var permissionsGranted = PermissionGranted().Result;
if (!permissionsGranted)
{
//TODO
}
}

private async Task PermissionGranted()
{
var permissionStatus = CrossPermissions.Current.CheckPermissionStatusAsync().Result;
if (permissionStatus != PermissionStatus.Granted)
{
var response = await CrossPermissions.Current.RequestPermissionAsync();
return (response == PermissionStatus.Granted);
}
else
{
return true;
}
}

Application hangs on RequestPermissionAsync method.

Any ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants