Have you seen a VLC media player or AliExpress app icon during Any special occasions?
Their Android app icon change according to the Event. While its Christmas time. Santa Hat will be there or take Black Friday. I managed to Capture this screenshot of the AliExpress icon.
How it's done? Bcoz the App is not updated recently. Not sure it's getting updated based on Date.
If you can read code, Here's an example function that changes icon, "This is only an example and has not been tested".
private void setIcon(int res_drawable)
{
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
Intent shortcutIntent = new Intent(getApplicationContext(), MainActivity.class);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.setAction(Intent.ACTION_MAIN);
ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(getContext(), "shortcut")
.setShortLabel(getResources().getString(R.string.app_name))
.setIcon(IconCompat.createWithResource(getApplicationContext(), res_drawable))
.setIntent(shortcutIntent)
.build();
ShortcutManagerCompat.requestPinShortcut(getApplicationContext(), shortcut, null);
}
else {
Intent i= new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, i);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
context.getResources().getString(R.string.app_name));
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(context, res_drawable));
intent.setAction(Intent.ACTION_CREATE_SHORTCUT);
context.sendBroadcast(intent);
}
}
If you look at the code, it seems that a Shortcut Icon is created on start-up.
I can't find a better way, other than setting it via a shortcut or by using Activity Aliases.
Another way is to manually edit the icon on Google Play, but I'm not sure if that takes effect on the installation or only on the PlayStore.
It seems that most companies use an update each season - The Christmas edition, the Easter edition etc...
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