Hello there 👋
Was wondering if anyone could provide some insight on how we can customize the app launcher icon programmatically?
Let's say we allow the user to select from a list of icons in the app on so screen, or allow them to select a color in the app, and then we want to replace the default launcher for our app... Is there a way to do this?
Ive read online some different "hacks" but nothing full proof or intentionally supported by Google for this type of customization.
Any insights would be much appreciated 🙌
😶 9
g
Gaurav Gupta
11/06/2022, 2:21 PM
You cant do it dynamically but your list item is fixed then you have define activity-alias in manifest file equal to no of icon
if user open app and user select any icon then you can change launcher icon
Copy code
getPackageManager().setComponentEnabledSetting(
new ComponentName("com.package.abc", "com.package.abc.MainActivity-Red"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);