Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android refactor to handle activities not named "Main" #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sidferreira
Copy link

@sidferreira sidferreira commented Jan 5, 2024

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 sidferreira changed the title Android refactor to handle activities not named "launch" Android refactor to handle activities not named "Main" Jan 5, 2024
@sidferreira
Copy link
Author

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

@pwltr
Copy link

pwltr commented Jun 26, 2024

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

@sidferreira
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants