16 July 2017

Supporting Samsung Devices in 2017 is easier than ever for Android 7.0

Updated on

        We cannot deny that Samsung Galaxy is one of the most popular devices in the world. This year, Samsung just follows its tradition of releasing a Galaxy phone per year and introduced a brand new Samsung Galaxy S8/S8+. Also, it introduce a new accessory which can convert your phone into a Desktop PC, Samsung DeX. This article will walk us through what Android developers need know about these technologies.


        Samsung Android devices are the one of the global brands that cause of Android Fragmentation for Android developers because Samsung has a lot of devices with different type of hardware. (software features also)

        Samsung is generous. Its SDKs are not restricted to its apps. Developers can use them in their own apps, too.

        Samsung is very serious about its 3rd-party developers. It update its SDKs so often. Below is an excerpt from its logs.

Changes in Android 7.0

        Generally, developers who want to support the Samsung's feature have to install Samsung's SDKs and write some code. That is why not many apps support Samsung's features.

        When Android 7.0 is coming, Samsung's latest SDKs combined with Android 7.0 are less hassled to work with.

        For example, MultiWindow, the one feature that was exclusive to Samsung many years, became a standard feature in Android 7.0 Nougat.

        Building an app to support MultiWindow in Samsung devices before Android 7.0 Nougat. You are required to add a few lines of code in your Android Manifest file.

        And what is about Samsung devices with Android 7.0 Nougat?

        MultiWindow in Samsung devices will work according to Multi-Window in Android 7.0 Nougat automagically. That means in the future, you may see Samsung's feature become standard features like Multi-Window and you just follow the best practice from official Android guideline.

Samsung's Fingerprint Scan

        I had to face the problem about fingerprint scanner in Pre-Marshmallow version. Because Android was announced Fingerprint API in Android 6.0 Marshmallow but some devices already have fingerprint scanner before Android 6.0 Marshmallow. That is a big problem for me!

        At that time, Samsung provided its Pass SDK for Samsung devices that has fingerprint scanning. So I can simply use Pass SDK for fingerprint scanning for Pre-Marshmallow and use Fingerprint API of Android API for Marshmallow or newer.

        For other brands, It cannot be done as SDKs for those specific other brands are not provided.

Samsung's MultiWindow

        As you know, MultiWindow used to be an exclusive feature in Samsung devices and including in latest Android version now.

        Pre-Nougat : Use Samsung's MultiWindow SDK
        Nougat or newer : Follow the Android official guideline for Multi-Window

        In Pre-Nougat, you just put some code in your Android Manifest, then handle config changes and instance state to support MultiWindow in Android 7.0 Nougat (Actually that is the best practice for Android app development!!). If you are already following the best practice guideline, you do nothing else.

Samsung Galaxy S8/S8+ and New Features

        When flagship phone from Samsung was announced. One thing that I think is "What additional lines of code are required to support its new features"

        But this year, the new features in Samsung Galaxy S8/S8+ are different than ever before. I was surprised because I did not have to use any SDK to support these new features in my app!

        The features that affect developers are as follows.

        • New aspect ratio (18.5 : 9) : To support this feature, Samsung called "Full Screen Apps"
        • Samsung DeX the desktop extension device for Samsung Galaxy S8/S8+

Supporting Full Screen Apps

        I really do not know why Samsung decided to use 18.5 : 9 aspect ratio and 18 : 9 on LG G6 also are non standard, so some normal apps will not be at full screen in Samsung Galaxy S8/S8+. My best guess is it was concerned about aspect ratio. Many apps are not that responsive.

        For unsupported apps, It will force to display in 16 : 9 aspect ratio and let the user enable/disable from the Settings > Display > Full Screen Apps

        If you want your apps to beautifully reach full screen, you should know these things:

        • SDK Version in build.gradle
        • android:resizeableActivity attribute in Android Manifest
        • android.max_aspect metadata in Android Manifest

android:resizeableActivity in Android Manifest

        This attribute was added in Android 7.0 Nougat to define the app that support Multi-Window or not. Define this attribute in <application />

android.max_aspect in Android Manifest

       This metadata is used to define max aspect ratio supported as aspect value. It looks like Android team added this metadata for a while but does not explain any detail about it.

        • 4 : 3 aspect ratio = 1.33
        • 16 : 10 aspect ratio = 1.60
        • 16 : 9 aspect ratio = 1.78
        • 18 : 9 aspect ratio = 2.00
        • 18.5 : 9 aspect ratio = 2.06

        If we do not define this metadata, default value is 1.86 (4 : 3, 16 : 10 and 16 : 9 supported)

Support format on Full Screen Apps

        There are 3 types of Full Screen Apps supports.

        • May not work properly : May not work but user can enable if it works.
        • Manually : User can enabled if it works.
        • Fully supported : Already supported.

May not work properly

        • SDK Version lower than 24
        • android:resizeableActivity="false"


        • SDK Version 24 or above
        • android:resizeableActivity not configured
        • android:max_aspect not configured or lower than 2.06

Fully Supported

        1st Condition
        • SDK Version 24 or above
        • android:resizeableActivity="true"

        2nd Condition
        • SDK Version 24 or above
        • android:max_aspect more than 2.06

Toggle Full Screen Apps = Configuration Changes

        Configuration Changes is the one of Android characteristics. Do not forget to handle it. When the user toggle Full Screen Apps, it will invoked Configuration Changes to your app.

Samsung DeX : One of features that developers must learn

        What we have to do to support Samsung DeX?

        It may seem that developers have to do something more to support this feature. But there is nothing to do. Just follow the best practice from Official Android guideline then your app will support Samsung DeX magically.

Different screen values between Phone mode and DeX mode

        Behind the scene of Samsung DeX is Freeform API in Android 7.0 Nougat. So you simply focus on Multi-Window then your app will magically work on Samsung DeX.

        For unsupported app, device will display similar with phone screen but running in DeX Mode.

        Both type have following screen values :

        Phone Mode
        • Resolution (px) : 2,960 x 1,440 px
        • Resolution (dp) : 740 x 360 dp
        • Density : XXXHDPI
        • Screen Size : Normal
        • UI Mode : Normal

        DeX Mode
        • Resolution (px) : 1,920 x 1,080 px
        • Resolution (dp) : 1,920 x 1,080 dp
        • Density : MDPI
        • Screen Size : Changing by user settings
        • UI Mode : Desk

        Warning : In DeX Mode, no matter how large the screen size. When retrieving the screen size programmatically, the result is always 1,920 x 1,080 px. So be careful about that.

Configuration Changes on Samsung DeX

        When the users switch between Phone mode and DeX Mode. The Configuration Changes are triggered which changes resolution and density that affect all running apps. If you declare android:configChanges attribute in Android Manifest, you have to do more works to handle it properly. Otherwise, you will encounter the problem about layout rendering.

        Configuration Changes is the one of Android development fundamentals that developers should know and understand.

        As I mentioned, an app that is incompatible with Multi-Window still works in DeX Mode with following screen values :

        • Resolution (px) : 731 x 411 px
        • Resolution (dp) : 731 x 411 dp
        • Density : MDPI
        • Screen Size : Normal

        However, any app that is incompatible with Multi-Window, should make sure to handle with Configuration Changes properly.

        If your app need to be run in full screen, you should support Multi-Window to avoid the problem about screen size measurement.

        As you see above, some parts of Facebook messenger's chat head are cut off, because it is incompatible with Multi-Window. So working area will be only 731 x 411 dp at the top left on the screen.

Screen resolution changeable generation

        Samsung devices that are running on Android 7.0 Nougat or above can change the screen resolution in the Settings > Display > Screen Resolution

        This is what developers have to handle.

When screen resolution has changed

        For Samsung Galaxy S6, S7 and Note 5
        • WQHD : 2,560 x 1,440 px
        • FHD : 1,920 x 1,080 px
        • HD : 1,280 x 720 px
        The screen resolution in dp still be 640 x 360 dp

        For Samsung Galaxy S8
        • WQHD+ : 2,960 x 1,440 px
        • FHD+ : 2,220 x 1,080 px
        • HD+ : 1,480 x 720 px
        The screen resolution in dp still be 740 x 360 dp

        But screen density has changed.

        • WQHD / WQHD+ : XXXHDPI
        • FHD / FHD+ : XXHDPI
        • HD / HD+ : XHDPI

         Screen density changing is depends on device's screen size.

        Absolutely, when screen density changed, that means Configuration Changes are invoked in your app.


        There are 3 features for Samsung devices : Full Screen Apps, Samsung DeX and Screen Resolution Changeable (MultiWindow is already added to the Android standard features)

        When we look at the key of these features, there are only a few things that we have to do and understand.

        • Responsive Screen Supporting
        • Handling Instance State
        • Configuration Changes

        Full Screen Apps
        • Responsive Screen Supporting
        • Handling Instance State
        • Configuration Changes

        Samsung DeX
        • Responsive Screen Supporting
        • Handling Instance State
        • Configuration Changes

        Screen Resolution Changeable
        • Responsive Screen Supporting
        • Handling Instance State
        • Configuration Changes

        You will see that they are all the same. And it is not new things that developers have to learn more. Just follow the best practice from Android guideline.

        • Understanding about Activity/Fragment lifecycle
        • Responsive app design
        • Handling instance state in Activity, Fragment and View
        • Understand about Configuration Changes and handle properly

        After we saw the overview of these features, we know that Samsung adjust its SDKs to conform with Android API. Our life is easier.

        Samsung DeX is the one of the best features that show us about our opinion in 3rd-party Android features. Although it looks different for users. But developer do not have to do anything. (and I think that Samsung DeX may be the one of the experiment projects between Samsung and Android that will include in next Android version definitely)

        Finally, let me end this article with ...

        Do your code follow Android best practice guidelines already?