Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Override Explicit Intent

My app needs to have a intent-filter that responds to a Intent that has it's component set (a explicit intent.) Here is a example.

Intent i = new Intent();
i.setClassName("com.compareeverywhere","com.compareeverywhere.ScanActivity");
startActivity(i);

Just a simple intent-filter will not do - because the Intent is made for a specific component (Activity,) it just launches that without looking for intents at all. Is there a way to do this?
Thanks, Isaac Waller
P.S: Please don't reply "No."

like image 575
Isaac Waller Avatar asked Dec 14 '22 05:12

Isaac Waller


1 Answers

No.

:) That being said, imagine what would happen if Android allowed people to hijack Intents for specific components. Don't like a competitor's app? Just have yours hijack his main Activity with your own to display porn. Intents can specify specific components specifically because the authors don't want others to be able to replace them.

You have two options. If this is your own code, replace it with a generic intent, or if it belongs to someone else, contact them, and ask nicely for them to change it to a generic intent along with some good reasons why that is necessary.

like image 104
sooniln Avatar answered Jan 04 '23 15:01

sooniln