Is it possible to get started in another apk using startActivity on Android, using an activity name or the like?

I tried to write an Android application with activity that should be launched from another application. This is not a content provider, but simply a gui application that should not be listed among installed applications. I tried the code examples here , and it seems pretty simple to run existing providers, etc., but I can't figure out how to simply write a “hidden” application and run it from another.

The main use case:

  • Appendix A is a regular apk launched from the list of applications.
  • Appendix B is another apk with well-known names of packages and actions, but it does not appear or is launched from the list of applications.
  • Appendix A launches Appendix B using the names of the packages and classes (or, perhaps, the URI built from them?).

I fail in the third step. Can this be done?

+4
source share
3 answers

Yes.

Use the package name and class name like this (to start Gmail):

new Intent("com.google.android.gm", "com.google.android.gm.ConversationListActivity"); 
+5
source

Why do you want to use "package and class names" to trigger actions in the second .apk ?

Why not use Intent , as this is the standard way to start an Activity ?

+1
source

On the same lines, if I have an application that usually runs an action, can I create it in apk by signing it with the private key. Will this allow access to this activity from other apks created by other developers?

+1
source

Source: https://habr.com/ru/post/1307457/


All Articles