Can i keep one .apk file in another .apk file and when i install first apk file the second .apk file should be installed same as while uninstalling.
Thanks in adveance.
Installing isn't too hard. You can put the second .apk file in the assets or raw resources folder of your first app. Then, when the first app runs, it can copy the .apk file to a temporary location and install the second app with something like this (lifted from this thread):
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 more complicated. You can't actually do what you want directly; you'll probably need a third app. It can register itself to receive ACTION_PACKAGE_REMOVED broadcasts and when it receives a broadcast that the first app is being removed, can remove the second app.
See this blog post for more details, including some settings that might be needed on the phone for non-market apps.
It won't be an .apk
rather you can create your another Application as Android Library
. You can keep your Project as Library and can put in or use into Another Applications.
You can also check this
thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With