Skip to content

How can I determine local device type that logged-in user is using?

0

I'm using Elastic Instances. Once a user is logged in, is there any way I can determine what kind of device they are using locally? I mean, are they using a Windows PC, a mobile phone (like an iPhone or an Android phone), a tablet (like an iPad), Mac, etc?

I need to know so my app can optimize the user display, i.e. decide how large to make fonts to make the display readable, etc. Note that changing the AppStream screen resolution (under Settings, Screen Resolution) doesn't help in that regard. Too low and the window isn't large enough to fit my app, too large and the text size gets so small it's unreadable.

I've checked the sessions environment variables and I see nothing there regarding device type. I can go to a command line and enter:

wmic computersystem get model,name,manufacturer,systemtype

but that returns information on the remote AppStream device, not the local device the user is using. Plus the information is quite generic.

The one thing that I have found that is typically different is the screen resolution as reported by Windows once the user logs in. In testing, I've found that the default resolution for my iPhone in portrait mode is 1002x640, iPhone in landscape is 480x1534, iPad in portrait is 1028x820, and iPad in landscape is 668x1180. I realize those numbers are subject to change and could be different for different models, but they're probably still relatively different, so currently I'm querying screen resolution to guess what type of device they're using. But I'm hoping there's a better-defined way.

Thanks.

asked 2 years ago240 views

2 Answers
1

Unfortunately, there isn't a direct way to determine the exact local device type that a logged-in user is using with Elastic Instances in AWS AppStream 2.0. AppStream 2.0 is designed to provide a consistent streaming experience across different devices, which means it abstracts away many of the specifics of the local device.

The approach you're currently using - detecting screen resolution - is actually one of the better methods available for approximating the device type. However, as you've noted, this method is not foolproof and can vary depending on device models and user settings.

Here are a few additional suggestions that might help:

  1. User Agent String: If your application includes a web component, you might be able to access the user agent string. This can provide information about the browser and operating system, which can give clues about the device type.

  2. Feature Detection: Instead of trying to determine the exact device type, you might consider using feature detection to optimize your display. This involves checking for specific capabilities (like touch support, screen size ranges, etc.) rather than trying to identify the exact device.

  3. User Preferences: You could consider allowing users to select their device type or preferred display settings manually. This could be stored as part of their user profile.

  4. Responsive Design: Implement a responsive design that adapts to different screen sizes and resolutions. This approach can work well across a wide range of devices without needing to know the exact device type.

  5. AppStream 2.0 API: While it doesn't provide direct device information, you might be able to use the AppStream 2.0 API to get some session information that could be helpful.

Remember that due to the nature of streaming applications, the ability to detect local device characteristics is limited. Your current approach of using screen resolution as a hint, combined with some of these other techniques, is likely the best way to approximate device types and optimize your display accordingly.
Sources
Use DescribeInstanceTypes with an AWS SDK or CLI - Amazon Elastic Compute Cloud
DeviceInstance - AWS Device Farm Documentation
DeviceType - Amazon Cognito User Pools

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

  • Hi, I'd agree with the bot on 1. : the agent String from the browser (if you've web components) is probably the simplest way to know about the client OS.

0

Hi, Didier_Durand. Thanks for responding. My users will be using a browser such as Safari or Chrome on an iPhone/iPad/Android phone/Android tablet, but the app I'm providing to them on AppStream 2.0 is a traditional Windows desktop app (with a GUI, using Win32 functionality) so there's no web component on the AppStream side. But since they're using a browser on the client side, is there a way I can get the agent string from their browser from within my app? I have the ability to execute things in a command prompt and can also execute PowerShell commands. Or, is there a way to make the browser send my app the agent string? Or, could I somehow "attach" a device identifier to the login URL they use? For example, the URL they will be using is this (with the ?ref= obfuscated):

https://appstream2.us-east-1.aws.amazon.com/userpools#/signin?ref=**********

Could I do something like this:

https://appstream2.us-east-1.aws.amazon.com/userpools#/signin?ref=**********&device=iPhone

And then somehow access that info within my app?

Thanks!

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.