This question is part of this #3
Some Chromebooks are laptop and we can also turn it into tablet mode. See images from here
So my question is how to programmatically detect the mode(laptop or tablet) of Chromebook. For this, I did this, but this is only working in Lenovo Flex11, in other Chromebook it is not working
context.getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES;
if this condition returns true that means Chromebook is in tablet mode else in laptop mode
I need to check this because if the Chromebook is in laptop mode than I have to show a prediction bar only in particular Activity. If it is in tablet mode the soft keyboard will appear and the prediction bar is managed by candidate view of InputMethodService
We use a combination of two different things. The first is we detect if the device is in desktop mode using the following code snippet :
To detect if a keyboard is plugged in and/or available we use the following listener for listening to whether or not a keyboard has become active:
This post is licensed under Apache 2.0.
https://developers.google.com/open-source/devplat