I want that an APP1 retrieve dynamically the package name of the APP2, i.e., without hard code APP2 package name.
The most obvious way to do that is to define an intent-filter in one of the APP2's components, such as receivers, activities, activities-alias and services. Then, APP1 would query for that specific intent-filter and then the magic is done.
However APP2 is just a resource package and indeed its android manifest declares hasCode="false"
in application session. So, APP2 (I think) can not place that components with intent-filters.
Keeping on mind that APP2 must not contain any code, is there a way to APP1 programmatically retrieve APP2 package name?
I figured out that, even if you declared an activity in you AndroidManifest.xml, you may not create the respective java class in app project. The project compiles fine.
So far, the solution is create a dummy activity tag in AndroidManifest, declare an intent-filter and use this filter do query this package name.
Realize that you may get an ActivityNotFoundException if you try to start the dummy activity using that intent-filter.
I think it is not an elegant solution but it works for now. I hope you post better solutions here.