| [Samsung DeX] Multi Instance Application on Samsung DeX | ||||
|
Blog
May 11, 2017
4
|
||||
Multi Instance Application on Samsung DeXCreating application compatible with Samsung DeX is not very demanding, but can lead to extending the usage of app, using external monitor, mouse and keyboard. Below you can find the example of usage of Multi Instance application on Samsung DeX.
Scope: Scenario:
Initial Samsung DeX compatibility for Multi Instance ApplicationTo make use of Samsung DeX, the application should comply with a number of Android N's new features. Some code modification may be necessary depending on what SDK version the app targets. Android N Multi-WindowSupporting Multi-Window allows apps to be dynamically re-sized in Samsung DeX, similar to a desktop environment.
SDK 24 or higher:
SDK 23 and lower: Multi-DensityTo properly work in Samsung DeX, the app must support Android Multi-Density. Multi-Density involves configuring apps with different resources so they can adapt to different screen sizes and resolutions.
Samsung DeX apps must support the following 2 resolutions: When optimizing an app for Multi-Density, there are 3 specifications apps must generally adhere to:
Support runtime configuration changesApp has to properly handle Android runtime configuration changes. This is to prevent apps from losing their current activity, display state or crashing when a user launches DeX or re-sizes an app in Desktop mode. It can be declared in Manifest.
Ensuring apps handle run-time changes is a part of following, Android's best practices. Application flowMainActivity is main window of application, opened in DeX mode. The window is resizable and can be dismissed. MainActivity initial window ![]() MainActivity resized window ![]() To launch separate Activity for every user item that will be clicked on the list, build Intent with flags:
Focus on windows can be changed by clicking window top bar or by clicking activity icon on task bar. MainActivity with multiple UserConversationActivities ![]() Tip: To manage focus of previously opened windows (ex. bringing back to front) you should obtain and stash taskId of the launched Activity and bring it back to front every time the user clicks previously opened window. Changing the focus of window can be done by mouse interaction or clicking the user on MainActivity list. ![]() Tip: Remember that the Activity is recreated every time the window is resized. Android and Samsung DeXSamsung DeX is an environment that mimics a window application environment, but works as an Android system and all the Android components undergo their own Android lifecycles. Therefore the window management is a Multi-Window mode on Android. For example: the window can be closed from the DeX mode by clicking "X" button. It disappears from the bottom taskbar, but can be brought back from the Task Manager. Only closing Activity from Task Manager dismisses the window. DeX mode with 5 windows open (MainActivity and 4 UserConversationActivities)and Task Manager with all Activities visible. ![]() ![]() DeX mode after closing UserConversationActivity “Frederick” window. ![]() ![]() More info about Samsung DeX on: http://developer.samsung.com/samsung-dex |
||||
|
||||