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

In this post, you will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...