Home > Blockchain >  Get Android CurrentActivity in .Net MAUI
Get Android CurrentActivity in .Net MAUI

Time:06-25

I'm porting a Xamarin.Android project to .Net 6.

Because of dependencies, it's not possible to include Xamarin.Essentials in the .Net 6 project.

So I'm switching everything to use the Microsoft.* namespaces. This was easy enough, except for Xamarin.Essentials.Platform.CurrentActivity.

Is there a .Net MAUI equivalent of this class? If not, any other good options other than copying/pasting the code from Essentials into the app?

CodePudding user response:

All of Essentials got rearranged to go under more logical namespaces. The one you are looking for is now under Microsoft.Maui.ApplicationModel.Platform.CurrentActivity

A full overview, where somehow this one is missing, can be found here: https://github.com/dotnet/maui/pull/5562

  • Related