question

DonGlover-0631 avatar image
0 Votes"
DonGlover-0631 asked DonGlover-0631 commented

Permissions.ShouldShowRationale doesn't exist

In the document Xamarin.Essentials: Permissions https://docs.microsoft.com/en-us/xamarin/essentials/permissions?context=xamarin%2Fandroid&tabs=android

The following line is included in a code snippet

 if (Permissions.ShouldShowRationale<Permissions.LocationWhenInUse>())

ShouldShowRationale does not exist in the essentials package. Is there some other way to get it or is this aspirational code rather than real code?

dotnet-xamarinformsdotnet-xamarinessentials
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JamesMontemagno avatar image
0 Votes"
JamesMontemagno answered

This is available in version 1.6, which is in pre-release nuget.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DonGlover-0631 avatar image
0 Votes"
DonGlover-0631 answered

@JamesMontemagno Thoughts on this?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DonGlover-0631 avatar image
0 Votes"
DonGlover-0631 answered DonGlover-0631 commented

@JamesMontemagno Thanks. The minimum version should be noted in the document. Also, it compiles now and runs now, BUT I am trying to prompt for camera permissions and the following does not issue a prompt.
status = await Permissions.RequestAsync<Permissions.Camera>();

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If it is in preview then it is in the pre-release. The docs don't have the concept of a minimum version right now, but somethign we are looking into.

Did you add the information into your manifest on iOS/Android/UWP?

Also on iOS if it already was prompted once then it wont prompt again.

0 Votes 0 ·

Yes. I did. (But, I am not compiling for iOS at this time.

42273-essperm.png

Also, while the docs don't have a concept of minimum version (a big problem on the API docs), as a frequent doc writer at Microsoft I have included statements such as this:

General Usage


The following presents the general usage pattern for determining whether a permission has been granted and requesting it if it has not. This code snippet uses features that are available with Xamarin.Essentials versions 1.6 and higher.




1 Vote 1 ·
essperm.png (35.5 KiB)

Ok, figured out the issue. I had to change how I was calling my method that called the method to check permissions.

I had been calling it (from when I was using Plugin. permissions):

Task.Run(() => spp.CameraPermissions());

changed it to:


PermissionStatus status = await spp.CheckAndCameraPermission();

And everything appears to be working correctly now.

Thanks for your help.

1 Vote 1 ·