2

How instagram not change shape in your icon to different mask (circle square, teardrop) in Android oreo.

screen shot of device with instagram installed:
screen shot of  device with instagram installed

I create the design of icon that Android indicate in this page Designing Adaptive Icons

screen shot of device with Direct installed:

enter image description here

This the code!

    <?xml version="1.0" encoding="utf-8"?>
    <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
        <background android:drawable="@color/ic_launcher_background"/>
        <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
    </adaptive-icon>

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <receiver
        android:name=".NotificationReceiver"
        android:enabled="true"
        android:exported="false"></receiver>
</application>
Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77
dv.gon
  • 159
  • 2
  • 11
  • 1
    They might not be using an adaptive icon. – Sakchham Jul 05 '18 at 17:44
  • if not work with the new format, the icon is added to circle mask with a small size. I hope can you help me!! – dv.gon Jul 05 '18 at 17:49
  • Set the `android:icon` attribute in your manifest to reference a mipmap. It will display your icon as is. Unless some launcher specifically adds a padding, but that is non-standard behavior you can't control it. – Sakchham Jul 05 '18 at 18:49
  • 1
    I change the manifest.xml and add `android:roundIcon="@drawable/ic_launcher_foreground" android:icon="@drawable/ic_launcher_foreground"` but not change – dv.gon Jul 05 '18 at 19:12
  • I am using `compileSdkVersion 27 buildToolsVersion '28.0.1'` – dv.gon Jul 05 '18 at 19:19
  • I have issue to compile with lower than 26, for example with the new format of notification. – dv.gon Jul 05 '18 at 19:33
  • for example the app Direct( of instagram) not change shape and have the new format or notifications! and I add a screenshot with direct installed – dv.gon Jul 05 '18 at 19:34
  • I try with this, but nor work: https://stackoverflow.com/questions/49597773/android-studio-image-asset-launcher-icon-transparent-background-color/49667272#49667272 – dv.gon Jul 05 '18 at 20:30

1 Answers1

1

As discussed here, you can use your own shaped icon if your targetSdkLevel is below 26, however this is not a good long term solution (you will have to target 26+ by November 2018). If you want to target Oreo, your best solution is to generate a proper adaptive icon. That said, I see a lot of icons on my Pixel 2 that aren't the right shape (Google Hangouts, Firebase, Street View, Firefox, Skype, Facebook Messenger, Outlook, etc...) and many others that are just the regular icon on a white background.

The exact behavior will depend on the launcher being used, so if you rely on the launcher allowing background layer transparency or respecting an odd icon shape you can get an inconsistent icon appearance between devices.

To test, I made a test project with targetSdkLevel of 25 and only provided a square icon and ran it on an emulated Pixel 2 with Android 8.1 and got a square icon, not forced to be round like the others.

With targetSdkLevel of 25

Then I upgraded to a targetSdkLevel of 27 without adding an adaptive icon and it put my square icon inside a white circle.

With targetSdkLevel of 27

Note that you don't have to set your compileSdkVersion to the same value as your targetSdkVersion. You could set your compileSdkVersion to 27 and use the v27 support libraries while keeping targetSdkVersion at 25 to get a square icon (until November).

compileSdkVersion 27
defaultConfig {
    applicationId "com.example.testproject"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
}
Tyler V
  • 9,694
  • 3
  • 26
  • 52