Windows Phone 8.1 and Windows Runtime Apps How to #6 – How to Detect the Current device Platform in Windows Universal App ?

When working with the Windows Universal App , it may be necessary for the developers sometimes to check if the target device is phone or windows 8 tablet and write the platform dependent code based on the criteria.

How to Detect the Current device Platform in Windows Universal App ?

You can use the #ifdef directives WINDOWS_APP and WINDOWS_PHONE_APP for this scenario.

Eg :

#if WINDOWS_PHONE_APP
    // Its a Windows Phone app
#endif
#if WINDOWS_APP
    // Its a Windows 8 app
#endif

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...