Forum Xamarin.Forms

Is it possible to update message or send back data in specific code by Dependency Injection?

xinmengxinmeng GBMember ✭✭
edited March 2016 in Xamarin.Forms

The situation is that, I am implementing to check location permission runtime (Android 6.0) in Xamarin.Form by using Dependency Injection. As we all know, when ask for the permission, the Android system will pop-up a dialogue to ask Allow Permission. After you click the Allow, the callback function will be invoked

public override async void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults){
    switch (requestCode)
        {
            case RequestAccessWifiStateCode:
                {
                    if (grantResults[0] == (int)Permission.Granted)
                    {   
            ///do something?
        }
        else{
            ///do something?
        }
    }   
    }
}

The question is : How can I update the UI or the data or return some value to the Form in this callback? because this dialogue is the system level which cannot be modified.

Official Doc: Note: When your app calls requestPermissions(), the system shows a standard dialog box to the user. Your app cannot configure or alter that dialog box. If you need to provide any information or explanation to the user, you should do that before you call requestPermissions(), as described in Explain why the app needs permissions.

Best Answers

Answers

Sign In or Register to comment.