question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor Maui .Net 6 /Request Again Permission (Deny Mode) In Blazor Page

See original GitHub issue

Hi, I have the same problem, but my problem is different. I want to get my request Permissin from the user in Blazor pages (For example. FetchData.razor), for example with a snackbar or some other Message way, But when the user rejects my permission request => Deny, I can not request again, please help !! @Eilon

if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessFineLocation))
        {
            // Provide an additional rationale to the user if the permission was not granted
            // and the user would benefit from additional context for the use of the permission.
            // For example if the user has previously denied the permission.

            var requiredPermissions = new String[] { Manifest.Permission.AccessFineLocation };
            Snackbar.Make(Test,
                           "plz",
                           Snackbar.LengthIndefinite)
                    .SetAction("ok",
                               new Action<View>(delegate (View obj) {
                                   ActivityCompat.RequestPermissions(this, requiredPermissions, 1);
                               }
                    )
            ).Show();
        }
        else
        {
            ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, REQUEST_LOCATION);
        }

_Originally posted by @masoodafar-web in https://github.com/dotnet/maui/issues/3694#issuecomment-1014880727_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
nisargagingocommented, Apr 27, 2022

for android after update 6.0.300-rc.2.5513+sha.8a017cf73-azdo.6048189 not able to access camera from html javascript. previously it was working by inherit class BlazorWebViewHandler and override WebChromeClient GetWebChromeClient()

public class MauiWebChromeClient : WebChromeClient
{
    public override void OnPermissionRequest(PermissionRequest request)
    {
        request.Grant(request.GetResources());
    }
}

public class MauiBlazorWebViewHandler : BlazorWebViewHandler
{

    protected override WebChromeClient GetWebChromeClient()
    {
        return new MauiWebChromeClient();
    }
}

But after update GetWebChromeClient gets compile error.

1reaction
javiercncommented, Apr 28, 2022

Since there is a separate issue for the other problem https://github.com/dotnet/maui/issues/6610 you are facing.

I’m going to close this issue as we already provided a working solution to the original problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permissions - .NET MAUI
Learn how to use the .NET MAUI Permissions class, to check and request permissions. This class is in the Microsoft.Maui.
Read more >
xamarin - .Net Maui: StorageWrite permission stops ...
The permission request dialog will show and the picture saved successfully after I granted the permission. Share.
Read more >
Check and Request Permissions in .NET MAUI - YouTube
Will you please do a full Bluetooth instructional video? I'm not a former Xamarin person, so setting up for native calls is new...
Read more >
NET MAUI Basics: Start Up, Permissions, App Data (W/ Blazor)
Net Maui with Blazor video that you should watch in order to get started ... Set Location in Emulator 17:00 Request and Check...
Read more >
How to Build and Secure Web Applications with Blazor
Learn how to build client-side Web apps using Blazor and how to secure them with Auth0 authentication and authorization features.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found