Search code examples
android

how to turn on external display on flip phone


I'm in the case of a flip phone like Galaxy Z-Flip 5. I want my app to display something on the small screen when the user tap on a button, like does the Photo app.

I've this code run on button tap :

    if (externalDisplay != null && !isExternalScreenActive) {
        // Activer l'écran externe
        externalPresentation = new Presentation(this, externalDisplay);
        externalPresentation.setContentView(R.layout.external_screen_layout);
        externalPresentation.show();
        isExternalScreenActive = true;
    }

When I tap on the button, nothing happens, there is no exception, no significant info in logcat, but the small screen remains OFF. If I close the phone and turn on the screen, I can see the presentation content ==> The presentation works.

My question : how do I turn the small screen ON ?

Thanks


Solution

  • It seems impossible to turn screen on in this way.

    Instead, I've found another API to do dual screen display : Jetpack Compose. This will allow you to display something on the rear screen at the same time than the main screen. The doc can be found here : https://developer.android.com/develop/ui/compose/layouts/adaptive/foldables/support-foldable-display-modes?hl=fr

    Problem : it cannot be used to display something on the rear screen when the device is fold. When the device is fold, my initial code with a Presentation works well.

    Hope this will help