How to Determine User's Environment

I would like to enquire as to how I can be able to determine the user’s environment so as to enable or disable some features.

An example would be if the operating system is android or screen width is less than 10" do this or do that.

There are two things you can use here: The first one is the WebBrowser object that you get from the current VaadinSession:

VaadinSession session = ui.getSession();
WebBrowser webBrowser = session.getBrowser();

You can see what all information you can find from WebBrowser here:
(for example: webBrowser.isAndroid() tells you if the current browser is an Android device)

Another useful method is a callback called retrieveExtendedClientDetails in the current Page object, which gives you more detailed information about the current client:

        UI.getCurrent().getPage().retrieveExtendedClientDetails(details -> {
            int screenWidthInPixels = details.getScreenWidth();
            // do something with screen width

More info here: