When I plug my phone into the DeX dock, my app window is minimized in the DeX taskbar. This is default behaviour.
I am using a Galaxy S8 running DeX 2.5.
I want my app to display (full-screen or windowed) immediately when plugged into the DeX.
What I have tried so far (as per advice on the Samsung DeX website)...
1 - I have applied the manifest meta-data that keeps the app process alive:
<meta-data
android:name="com.samsung.android.keepalive.density"
android:value="true"/>
2 - I have applied the configChanges property to intercept config changes:
android:configChanges="orientation|screenSize|smallestScreenSize|density|screenLayout|uiMode|keyboard|keyboardHidden|navigation"
This works as expected when the device is rotated, or when the screen is resized within the DeX interface i.e. Activity.onConfigurationChanged(Configuration) runs.
But this does not get triggered by plugging the phone into the DeX.
3 - My activity has been set to resize in the manifest:
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
- Is there a way to get the window to automatically display when plugged into the Dex?
- Is there a way to get a callback when plugged into the DeX, and then launch my app from that calllback?
This info is only valid for DeX v2.5. Updates to DeX v3 broke the below code.
When a device is docked into, or undocked from, the DeX, the following intents are broadcast by the system:
android.app.action.ENTER_KNOX_DESKTOP_MODEandroid.app.action.EXIT_KNOX_DESKTOP_MODEAny app can register a receiver in the manifest to be notified when the device is docked:
Inside the receiver the app can relaunch itself.
This causes the app to launch in a normal window when docked.
To ensure full-screen launching, there are 2 changes to make in the manifest.
1) Add DeX
meta-datainside theapplicationblock:Here the
0values tell DeX to use the maximum width/height possible.2) Add a
layoutblock to theactivitythat is being launched:Here the
5000dpvalues must be bigger than the screen that you are plugging into the DeX.Both launch size blocks are recommended by Samsung in different places - my experience was that the second option worked on the S8 (DeX v2.5).