react-native-change-icon icon indicating copy to clipboard operation
react-native-change-icon copied to clipboard

Android refactor to handle activities not named "Main"

Open sidferreira opened this issue 1 year ago • 5 comments

I had a specific need where the Activity running the icon change was not the one that launched the app. This change tries to allow LaunchActivity to be the Launcher and MainActivity to be the one running the show.

Part of the trick is to use the code below to find the current launch activity:

Intent intent = packageManager.getLaunchIntentForPackage(packageName);
_currentLaunchClassName = intent.resolveActivity(packageManager).getClassName();

I played a lot with the code, renamed some variables to add clarification, and tried to make it more flexible.

My goal was to avoid killing the app when changing the icon, but I'm still tweaking this part.

It seems that there were some changes in the code after the latest release, so extra caution is needed reviewing that.

sidferreira avatar Jan 05 '24 22:01 sidferreira

@skb1129 @haydncomley I'll try to spend some time reducing the difference from my code to main this week

sidferreira avatar Feb 12 '24 17:02 sidferreira

I'm running this PR branch on my app and it works, seems to fix #74 and #106

pwltr avatar Jun 26 '24 12:06 pwltr

@skb1129 anything I can do to help with this review?

sidferreira avatar Jul 15 '24 12:07 sidferreira