3

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.

Check AliExpress App Icon

MC Naveen
  • 440
  • 5
  • 17

2 Answers2

2

They make Updates for each season. Each Update has a new customized icon in res/drawable

Also, you can declare a different launch event and then make that launch event icon different.

Empire of E
  • 588
  • 6
  • 12
  • Then they're creating a custom shortcut depending on the date ... here's the answer i found - https://stackoverflow.com/a/50849486 – Empire of E Nov 23 '19 at 22:31
0

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...

Empire of E
  • 588
  • 6
  • 12