Installation is not too complicated. You can put the second .apk file in the resource or source folder of your first application. Then, when the first application starts, it can copy the .apk file to a temporary location and install the second application with something like this (removed from this stream ):
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile( new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive"); startActivity(intent);
Uninstalling is a little trickier. You cannot do what you want; you will probably need a third application. He can register to receive ACTION_PACKAGE_REMOVED and when he receives a broadcast that the first application is removing, the second application can be deleted.
See this blog post for more details, including some of the options that your phone might require for non-market applications.
source share