Couldn’t find anything in the API useful. Only UserInputService.TouchEnabled and stuff. But there’s touchscreens.
This doesn’t actually work. For example, I have a laptop with a touch screen. If I launch the UWP Roblox client, and then use the touch controls, both TouchEnabled and ModalEnabled will be true. Also note that the value of ModalEnabled will change depending on whether the last input type was touch based.
We deliberately do not expose any interface for you to tell whether you’re actually on a mobile device. You should define your UI in terms of functionality (user input type, screen size, whether it’s a ten foot interface), not in terms of device classes.
One of the reasons we don’t have an interface to tell whether you’re on a mobile device is because that would require us to actually define what a mobile device is. There’s a huge number of weird in-between devices where your hardcoded checks for “isPhone” or “isTablet” break down. For example:
- Devices which market themselves as “tablet phones” or “phone tablets”. Verified reviewers are split over whether they consider the device a tablet or a phone. It’s literally up to the user’s preconceptions of the device whether it’s a tablet or a phone.
- 2-in-1 convertible laptops which run Windows but can become a tablet very easily. (e.g. Surfacebook, where the actual computer is a tablet, and then it has a fancy attachable keyboard which contains a dedicated GPU and more batteries)
- Hooking up a bluetooth keyboard and mouse to an iPad.
Is there a reason why tablets and phones are separated, like why don’t they both fall under a “Mobile” category?
Do you mean on the website? If so, I’m not sure.