Show an application A within the fragment of another application B

1

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

But, instead, would it be possible to open a Fragment whose content would be the Contacts application itself, ie show the contacts application within my app?

    
asked by anonymous 18.12.2015 / 12:03

1 answer

1

No "root" phones:

Unfortunately, you can not display an application within your application without your phone having the root (permission) permission, because you can only interact with other applications via Intent . As long as developers decide how their applications should react on specific%%, doing something like this is almost impossible.

For "root" phones:

1) You can display a list of all installed applications by doing this:

getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

2) If the user selects an application, you can run it via Intents and create Intent to capture all key events . You can find a way to do this here >. Store all x / y events of these events.

3) You can recreate events using system overlay .

4) Now comes the part that you need a device with access MotionEvent#obtain (the permission root ). Run the app and inject all events in order for your macro to run. 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 within your own, but the chance of your users having a device with access INJECT_EVENTS is very remote, and its application is considered as risk.

Reference:

link

    
18.12.2015 / 14:27