What is the replacemet of WindowInfoTracker in Mauii

khatauli 61 Reputation points
2024-07-23T01:18:00.68+00:00

I am using WindowInfoTracker in Xamarin to detect if the device is foldable or not, and if it is foldable, I want to know if it is folded or half folded itc.

I don't see any replacement of this in Maui. If there is any alternative, I would like to know urgently.

If not, I would request the Xamarin team to release another version of Xamarin, while Maui catches up to all the things which are supported by Xamarin!

I feel that Maui is not practically ready to replace Xamarin, and Microsoft should not abandon Xamarin users dead in the water.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,607 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 32,546 Reputation points Microsoft Vendor
    2024-07-23T06:58:11.1566667+00:00

    Hello,

    WindowInfoTracker is a native Android API, which is from AndroidX. (AndroidX is a part of MAUI)

    And you can invoke the platform code in your MAUI project directly by adding conditional compilation.

    For example,

     #if ANDROID
                var windowInfoTracker = WindowInfoTracker.GetOrCreate(Platform.AppContext);
    #endif
    

    For more details, please refer to .NET MAUI invoking platform code - .NET MAUI | Microsoft Learn

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.