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

WIP: launch activity using broadcast intent #53

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

Conversation

wunter8
Copy link
Contributor

@wunter8 wunter8 commented Mar 3, 2023

I don't think I'm going to finish this. Apparently when you use the android.intent.action.MAIN intent, you have to use ctx.startActivity instead of ctx.sendBroadcast. (See https://developer.android.com/reference/android/content/Intent#standard-activity-actions)

So to do it "right", I think we'd need to compare action.intent to everything in that list of standard activity actions. If it's in the list, use ctx.startActivity. If it's not in the list, use ctx.sendBroadcast. But at that point, this becomes a much bigger PR and it has only been requested once so far.

I'll just leave this code here in case we decide to pick it up again in the future.

@wunter8
Copy link
Contributor Author

wunter8 commented Mar 3, 2023

This code works for launching an app based on the given package and class, but I only tested it with the android.intent.action.MAIN intent. I didn't check or test any other cases, and I am just blindly assuming right now that if action.intent_package and action.intent_class are set, it should always use ctx.startActivity instead of ctx.sendBroadcast

@binwiederhier
Copy link
Owner

I'll just leave this code here in case we decide to pick it up again in the future.

Agreed. I do think it has been requested more than once though. But if we do it, we definitely want to do it the right way

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.

2 participants