2

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.

iHavADoubt
  • 79
  • 1
  • 9
  • install different app to support your current app? i think its impossible for install app without telling the user. for security reason. why its not possible to combine the service and app? – Randyka Yudhistira Mar 03 '15 at 01:18
  • 1
    Simply put, you cannot install an app without letting the user know. This is just a big security hole. – Lawrence Choy Mar 03 '15 at 01:24

1 Answers1

2

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

Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137