Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Wrong icon on header, when app is running in backround

Tags:

android

icons

On 99 % of devices app icon on header taskbar is showing without problem: image

but on Sony Xperia Z3, Lollipop, it appears as white square: image

heres application section from my manifest doc:

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="intent.to.front" />

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

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="hidden" />

        <activity
            android:name=".FromActivity"
            android:label="@string/title_activity_from" />
        <activity
            android:name=".ToActivity"
            android:label="@string/title_activity_to" />
        <activity
            android:name=".RateActivity"
            android:label="@string/title_activity_rate" />
        <activity
            android:name=".VerificationActivity"
            android:label="@string/title_activity_verification" />
        <activity
            android:name=".CrashActivity"
            android:label="@string/title_activity_crash" />
        <activity
            android:name=".OrderProgressActivity"
            android:label="@string/title_activity_order_progress"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="intent.to.front" />

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

So if you know answer, please help and why is it only happening to xperia device?

like image 667
Nikoloz14 Avatar asked Dec 05 '25 15:12

Nikoloz14


1 Answers

Lollipop devices add there own square to notification icons. You need to make sure that your image has an alpha background so when a color fill is applied to it, you can still see the image.

If you still want it to appear as it does on older devices you can do some checking code to see what version of Android they are running and supply a different icon.

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {

}
like image 110
vguzzi Avatar answered Dec 08 '25 16:12

vguzzi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!