qDevice - A utility for getting user devices

qDevice is a utility module for Roblox Luau that allows you to easily find a device that a user is on.

Backstory

I was looking through the various platform modules on Roblox, and I found that they were either:

  • Extremely outdated
  • Complicated
  • Did I mention outdated? Lol

So, to solve all those problems, I created qDevice as a successor to other platform modules.

Features

qDevice has a lot of features packed into the module, including:

  • Getting device orientation (landscape or portrait)
  • Checks for Xbox AND PlayStation (or just console in general) thanks to recent updates
  • Checks for Phones and Tablets (arguably one of the best features, but hackiest, so far)
  • Support for VR finding
  • PC checks (obviously)
  • [EXPERIMENTAL :test_tube:] Support for checking controllers connected to a PC.

Why use qDevice?

If you’re not convinced to use qDevice yet, this part might be for you! Use qDevice, because:

  • qDevice uses no external dependencies, it is only 1 module.

  • qDevice supports Xbox and PlayStation specific checks, which no other platform module has done yet to my knowledge

  • qDevice is open source and licensed under the MIT License

I’m convinced! Where can I get this?!

The main place right now is to download this on Github:

Once there, you can pick up a copy of the source code by downloading the RBXM file attached to the releases.

What will come next?

The main thing that comes next will be to support Rojo on the repository, as well as make this a Roblox Package for people who don’t want to constantly download this from GitHub.

If you read all the way through, give yourself a high five! Sometimes people need it in life

24 Likes

Could you change the return type of qDevice.GetDeviceOrientation(): string to Enum.ScreenOrientation?

3 Likes

Hi there, sorry for the delay. I’ve pushed an update to qDevice as qDevice 1.0.2 which should have implemented the fix you described. If there’s any issues, let me know!

3 Likes

This thing looks cool, I’ll give it a try

2 Likes

Would it be possible to detect if the user is on Windows/Mac, or Android/iOS?

1 Like

This is impossible to do without getting the last known keycode on PC, which is bad practice because these keycodes can swap frequently depending on what device is being swapped to. For example, switching from PC controls to Console controls.

Hypothetically, what you could do is check the version of the client and compare it to the latest version available but then you’d need to use HTTP to get the version number each time and… you can kinda see how annoying this is.

This works… for now until Roblox provides a work-around.

It’s probably easier to get Mobile/Console brands due to their screen resolution. You can’t change the viewport size on those, but you can on computer.

So all you’d need to do is look online to find all Android, and iOS resolutions, and compare it to the current viewport size. Xbox and Console can be determined easily because of the new playstation update like you said.

Unsure how to tell Mac and Windows apart. Maybe Mac’s Command/Option/Control keys vs Ctrl/Alt would help.

You could use string literal type (such as "None" | "Mobile" | "Tablet") for qDevice.GetMobileDevice() instead of string as return type so the typechecker would have to only work with three of those strings.

Also qDevice and qDeviceExp dont work like that, if you want to make both tables usable, you could either modify module to import qDeviceExp functions to qDevice if experimental, or give it a metatable {__index = qDeviceExp}.

Although glad somebody made a module so we don’t have to reinvent the wheel of “um what device is this player using”

1 Like

qDevice version 1.0.3 is now released as an RBXM! This implements fixes sent in by VSCPlays, with other fixes suggested by vvv331. Hopefully, this version is more enjoyable than the last

Nice module, i’ll use it fosho

1 Like