Xamarin – Cannot override OnRequestPermissionsResult
Asked Answered
A

1

7

I've got a class that extends Activity and implements IOnRequestPermissionsResultCallback.

I want to use OnRequestPermissionResult and I coded it exactly as in XamarinBlog (section Handle Permission Request) and Monodroid Github but I always get no suitable method to override error.

namespace App1
{
    class Aplication : Android.App.Activity,
                       Android.Support.V4.AppActivityCompat.IOnRequestPermissionsResultCallback
    {

        public override async void OnRequestPermissionsResult(
            int requestCode,
            string[] permissions,
            Permission[] grantResults
        ) { }

    }
}

How can I use the new Marshmallow permissions in Xamarin?

Avail answered 13/9, 2016 at 15:23 Comment(0)
H
13

Most likely you use wrong Permission type (there are several types named Permission in different namespaces). Try this:

class Aplication : Android.App.Activity,
    Android.Support.V4.AppActivityCompat.IOnRequestPermissionsResultCallback {

    public override async void OnRequestPermissionsResult(
        int requestCode,
        string[] permissions,
        Android.Content.PM.Permission[] grantResults
    ) {
    }
}
Headphone answered 13/9, 2016 at 15:38 Comment(1)
You're a hero!!Avail

© 2022 - 2024 — McMap. All rights reserved.