Gabriel Pereira
Gabriel Pereira

Reputation: 580

How to check device build configuration, for android:roundIcon support programmatically?

The new API 7.1 now support round Icons

We can create both versions circular and square on AndroidManifest, but how to know if the device accepts android:roundIcon?

To use programmatically R.mipmap.ic_launcher or R.mipmap.ic_launcher_round

I used this version check:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
    builder.setLargeIcon(BitmapFactory.decodeResource(context,
                         R.mipmap.ic_launcher_round));
} else {
    builder.setLargeIcon(BitmapFactory.decodeResource(context,
                         R.mipmap.ic_launcher));
}

But this do not work for some devices like Nexus with Android 7.1, just on Google Pixel, It depends on the device build configuration.

How to check it? Thanks

Upvotes: 2

Views: 213

Answers (0)

Related Questions