27

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?

1

1 Answer 1

50

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

Sign up to request clarification or add additional context in comments.

1 Comment

This is very useful for simple android conditionals. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.