Xamarin: Make a different page appear upon button press if Android version is 6 or below

Joseph Banning 21 Reputation points
2021-11-15T01:39:27.273+00:00

I have a problem where some content on one of my app pages only shows for more recent versions of Android. The solution I'd like to implement is to present totally different content to Android 6 and below phones. The problem is, I haven't found a function like OnPlatform and OnIdiom that applies to Android version. Is there something like this?

Thanks,
Joe

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,378 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 79,781 Reputation points Microsoft Vendor
    2021-11-15T06:20:14.903+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    You can use Xamarin.Essentials: Device Information to get the Android device version like following code with background code.

       var version = DeviceInfo.VersionString;  
    

    Tips:If you want to make different pages based on the Android version. you can binding a value forViews or Controls' IsVisible property to control them or You can naviagte diferent pages by the Android version.

    Best Regards,

    Leon Lu


    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.


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.