简体   繁体   中英

Android: IntentFilters for components

What is a reasonable way to filter out specific cmp Strings with an Android IntentFilters which are declared in code in broadcast Receivers (rather than in android.xml)?

The case I'm searching for has:

   action = android.intent.action.MAIN
   category = android.intent.category.LAUNCHER

Any advice would be greatly appreciated.

I do a positive test for stuff I'm interested in and ignore everything that doesn't conform, as opposed to negatively trying to throw away all possible non-interesting things and keeping what's left. But maybe I've misunderstood your problem.

The issue was the intent filter only works over the application in which it occurs. This meant MAIN and LAUNCHER wasn't finding anything except for application relaunch events which weren't actually occurring. The system freeze up was caused by a separate error on the phone, not by the FILTER actually processing over too much information.

Still not sure how to search within an app by cmp or Component but the bigger issue was not finding stuff outside the application and that has alternative approaches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM