I have a regular Android application which I am planning to deploy on the Google Play Store.
This application needs a custom application service (no UI) to work as expected. [It is not possible to combine them together].
To improve the User Experience, I would like to make sure that the installation of this application service is invisible to the user. Essentially, I would like to install & update this App2 silently in the background.
What would be the best way to do this?
Thanks.
Your best bet is to just prompt the user to voluntarily install it. You could even make a prompt, let the user know that your app will not function if this other apk is not installed, and give them the choice to install it.
As stated before, there is absolutely no way to install an app without showing the user the full permissions list of the app before installation. This is a strict rule enforced by Google, for good reason. Imagine the security risk of allowing any app to silently install another app!
Here is a simple example of something you could do:
PackageManager pm = context.getPackageManager();
try{
pm.getPackageInfo("com.theappyouneed.example", PackageManager.GET_ACTIVITIES);
//If you get here, the app is installed, nothing to do.
Log.i("MyApp", "package already installed! Awesome!"
}
catch (NameNotFoundException e){
//App is not installed, launch Google Play Store
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.theappyouneed.example"));
startActivity(intent);
}
Documentation on linking to products: http://developer.android.com/distribute/tools/promote/linking.html