Show an application A within the Fragment of another application B

Asked

Viewed 84 times

1

In my app, when the user clicks Add Contact I call the Contacts app using a Intent.

But instead, it would be possible to open a Fragment whose content would be the Contacts app itself, i.e., show the contacts app inside my app?

  • I don’t think it’s possible, just by customizing your own View, bringing only the contacts and displaying them.

1 answer

1


No phones "rootados":

Unfortunately, it is not possible to display an application within your application without your phone having the permission of Administrator (root), because you can only interact with other applications via Intent. Since developers decide how their apps should react on Intents specific, something like that is almost impossible.

For phones "rooted":

1) You can display a list of all installed apps for this:

getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

2) If the user selects an application, you can run it via Intent and create a system overlay to capture all keystroke/keystroke events. You can find a way to do that here. Store all x/y events from these events.

3) You may recreate the events using the MotionEvent#obtain.

4) Now comes the part you need a device with access root (the permission INJECT_EVENTS). Run the app and Launch all the events for your macro to be executed. Example:

Instrumentation mInstrumentation = new Instrumentation();
mInstrumentation.sendPointerSync(motionEvent);

You can find more information about injections here.

5) If you need help compiling your application, these two links will help you: How to Compile Android Application with system Permissions and Android INJECT_EVENTS permission

SUMMARY:

It is possible to display an application inside yours, but the chance of its users have a device with access root is very remote, and its application is considered as a risk.

Reference:

https://stackoverflow.com/questions/23869037/app-inside-an-app

Browser other questions tagged

You are not signed in. Login or sign up in order to post.