I'm new to app development, and I'm using Xamarin forms for cross-platform support. I don't understand when to ask for permissions, though. Do I ask on demand, when I need to use the camera, for instance, or do I ask when the app is loaded? If I ask on demand, I can do that with a helper function, but if I ask when the app is loaded, when do I do that? Is there a function I should override or do it in the OnCreate() function?

Also, do I only need to do this in the Android code or do I need to write code for the iOS project as well?

Also, what is the OnRequestPermissionsResult function used for? Do I need to write any code inside that function?

I set the permissions in the Android's project property sheet in Visual Studio, and I edited the info.plist file directly for the iOS project, but beyond that, I'm lost, so any advice people have on permissions would be appreciated.

I'm using a Xamarin Shell app that was auto-generated in Visual Studio. The auto-generated code uses the Xamarin.Essentials library for permissions, which sounds great, but I have no idea how to use that class.