0

I need to download apk file from server to device and then install it silently without any user interaction. I'm using a rooted android device. Is it possible to do? Is there any way I could do that?

I used following code to install the apk. But it asks from user to press Install or cancel.

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(new File(sdcard,"Android/data/com.mycompany.android.games/temp/temp.apk")), "application/vnd.android.package-archive");
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
        context.startActivity(intent);
Pavitha
  • 181
  • 2
  • 10
  • 1
    Luckily what you want is impossible. – greenapps May 08 '18 at 08:44
  • What I need is download and install app update without user interaction on rooted device. Can't a rooted device do that :( – Pavitha May 08 '18 at 08:49
  • `"install it (update) silently without any user interaction"` That would break the security that Android put in place to stop malware. – Jon Goodwin May 08 '18 at 08:58
  • 1
    Yes true, but I thought it is possible in rooted ones. Anyway Thanks guys.... – Pavitha May 08 '18 at 10:12
  • 1
    Does this answer your question? [Install Android system app, silent update without Google play on rooted device.](https://stackoverflow.com/questions/31936361/install-android-system-app-silent-update-without-google-play-on-rooted-device) – mahdi Jul 22 '21 at 13:56

1 Answers1

0

What I did so far is https://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/ and it is working fine for my case.

One point, my application is running on non-rooted device and I signed my app by device manufacturer's platform key.

Md Sufi Khan
  • 1,751
  • 1
  • 14
  • 19