Flex Window

The Cover Screen of the Galaxy Z Flip5 is far bigger than that of previous models. We call this new screen the Flex Window.
Since the screen is larger, it is important to use the Flex Window efficiently.
We can use the optimized full size application widget on the Flex Window.

Add your Widgets to the Flex Window

To show widgets on the Flex Window, we need to add some attributes to AndroidManifest.xml.

Folding features

Each display feature area can be characterized by its bounding rectangle in the window coordinate space and its type.

<receiver
        android:name="com.samsung.android.myFlip5WidgetProvider ">
        
....

        <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/meta_info_calendar_widget" />
         <meta-data
                android:name="com.samsung.android.appwidget.provider"
                android:resource="@xml/samsung_meta_info_sample_widget" />
</receiver>

First, add the following to “android.appwidget.provider”:

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"

....

    android:minWidth="352dp"
    android:minHeight="339dp"
    android:resizeMode="horizontal|vertical"
    android:widgetCategory="keyguard"

</appwidget-provider>

There, you must set four attributes: The size of flex window using the “minWidth” and “minHeight” attributes, as well as the “resizeMode” value at “horizontal | vertical”, and the “widgetCategory” value at “keyguard”.

Second, in “com.samsung.android.appwidget.provider”, add “display = “sub_screen”” which sets the widget to show on the Flex Window:

<samsung-appwidget-provider
    display="sub_screen">
</samsung-appwidget-provider>

You can now see your own widgets on the Flex Window of the Flip5. Next, let’s increase the usability of your widgets!

Choose the Screen Where to Start an Activity

Let’s start an activity from your widget. If you set the launchDisplayId value of the Activity Options to pendingIntent, you can start the activity on the screen you declared.

val pIntent = PendingIntent.getActivity(
     context,
     0,
    ACTIVITY_YOU_WANT_TO_LAUNCH,
    PendingIntent.FLAG_CANCEL_CURRENT or
    PendingIntent.FLAG_IMMUTABLE,
     ActivityOptions.makeBasic().apply {
    launchDisplayId = ( MAIN_SCREEN_ID = 0 , COVER_SCREEN_ID = 1)
    }.toBundle()
)

remoteViews.setOnClickPendingIntent(YOUR_LAYOUT_ID, pIntent)







Create an Ongoing Notification on the Flex Window

We have also provided a way to show ongoing notifications on the Flex Window. When a widget on the Flex Window sends the ongoing notification, you can customize the view of the notification:

NotificationCompat.Builder(context, CHANNEL_ID)

....

    .setSmallIcon(R.drawable.SAMPLE_SMALL_ICON)
    .setColor(Color.parseColor(SAMPLE_COLOR))
    .setContentTitle(SAMPLE_TEXT_TITLE)
    .setOngoing(true)
    .build()









  1. setSmallIcon: Image to show on the left side of the notification.
  2. setTicker: Description to show on the notification.
  3. setColor: Background color of the notification on
  • setOngoing: Set to “True” to show the notification.