SAPUI5: What is the best Reliable way to detect on which device my app is running?
I have developed a sapui5 app that can run on iPhone, iPad, and desktop. Depending on the running media, it will use different theme or UIs. The are several ways of detecting OS, device or screen resolutions, such as:
$('#phone').css('display') == 'none'
My question: what is the best and Reliable way in the code to find out which of the following devices my app is running on:
"iPhone" (valid for all kinds of resolutions)
"iPad" (all possible types)
Andreas Kunz replied
the sole purpose of this Device API is the detection of different device/platform characteristics, so it should be reliable or will be fixed in case it is not.
Just be sure to understand the detection it does. E.g. for Android phones and tablets: where is the border? Is a Galaxy Note a phone or a tablet? Or the Microsoft Surface tablets, are they really tablets - they can have a keyboard - or are they laptops (="desktop")? So the decision is not always clear, but the API has its defined behavior for these edge cases.
For iPhone/iPad the decision is very clear, though.
Standalone detection is not part of the API.