QA team reported the bug on Pixel2 XL android Q (10) - The app icon is not displayed while the app is in background in the stack of apps (recents).
In the app used an adaptive icon created through 'Image Asset'. On previous Android versions - all good. But some times after the setup app through Google Play (or directly from an android studio) - app icon is not displayed when the app is backgrounded in the stack of apps. It happened not always.
wrong behavior
right behavior
For test was created default empty project with an adaptive icon (with legacy icons and icons for any dpi-v26). Bug reproduced. Also on the emulator with android 10.
In manifest:
<application
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:supportsRtl="true">
.....
Renaming app icons and other solutions don't help.
Update: I think it is a system bug. Because default apps like calendar have the same issues.
Thanks in advance!
The onPause() and onResume() methods are called when the application is brought to the background and into the foreground again. However, they are also called when the application is started for the first time and before it is killed. You can read more in Activity.
Foreground services perform operations that are noticeable to the user. Foreground services show a status bar notification, so that users are actively aware that your app is performing a task in the foreground and is consuming system resources.
You can detect currently foreground/background application with ActivityManager. getRunningAppProcesses() which returns a list of RunningAppProcessInfo records. To determine if your application is on the foreground check RunningAppProcessInfo.
The issue because of somewhere else this icon exists which shown in your wrong behavior So just check is there any icon exists with wrong design which is.
Like in my case here two directories which contain icon with different background, So I am deleting the icon from this directory or otherwise, I delete this two directory and its work fine(Note: Don't delete directory go on explore and then delete.).
mipmap-anydpi-v26
drawable-v24
I had the same problem on real device, using Android 10 API level 29. Renaming the icons also did not fix it.
The solution I figured is to use new "adaptive icons". What this will basically do is generate adaptive icons which are not covered in the mimap
folders. Use the following steps:
android/app/src/main/res/
folder of your projectmipmap-anydpi-v26
folder if it does not exist.xml
file inside mipmap-anydpi-v26
folder. This xml
file should be named exactly same as the string you are using for your icon name. For example, by default the name of icon string is ic_launcher
, so name this xml
as ic_launcher.xml
.xml
should have the following lines, nothing else. You can paste these if you have made a new file in step 3. Make sure that you have _background
and _foreground
postfixes to the names as shown below. If you don't have these and just use @mipmap/ic_launcher
for both background and foreground, it won't work.<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
ic_launcher_background
. Do the same for foreground using whatever image you need as foreground in icon and download it with the name ic_launcher_foreground
.res
folders one by one to android/app/src/main/res/
.mimap
folder with for foreground and background.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With