I need to have a mechanism where an app auto-updates itself without any user interaction. The app is an off the shelf app (off market). Updates should happen in background without any click. How can we achieve this?
Asked
Active
Viewed 363 times
1
-
If "update" is modifying src or res then you cannot. This kind of update basically uninstalls previous version and installs current version. – inmyth May 07 '15 at 13:10
-
Installing current version will still ask the user to accept it. I want no user interaction. Is it possible? – Harsh May 07 '15 at 13:11
-
1no it's not possible. User must submit that he understand apps permissions and agree to install it. It's possible to do that on root phones. How do you want to deliver then apk to users phone? – Andrew V. May 07 '15 at 13:13
-
TestFairy does it... but never in background. Remember @Harsh asked about a non-market app. – shkschneider May 07 '15 at 13:13
-
1In TestFairy user need to install the app. – Harsh May 07 '15 at 13:14
-
check this one http://stackoverflow.com/questions/5803999/install-apps-silently-with-granted-install-packages-permission – Andrew V. May 07 '15 at 13:15
-
On way can be downloading the apk from the server and then unzipping it. Is there a way to unpackage the apk from SD Card? – Harsh May 07 '15 at 13:15
-
@Harsh you mean the user should not install the app even once in your case? Come on. You asked about "auto-update",. You know how TestFairy works, right? You install the APK *once* and it updates, if needed, when launched... – shkschneider May 07 '15 at 13:16
-
@AndrewV. tried the above answer. User still needs to click on Install. My requirement says "no clicks". – Harsh May 07 '15 at 13:16
-
@ shkschneider When we upload a build on testfairy we can invite the testers via email. The user still have to go to email and install it. I need to bypass that process – Harsh May 07 '15 at 13:19
3 Answers
1
This is not possible, except perhaps on rooted devices or via your own custom ROM. Apps cannot install or update any apps (their own app or the apps of others) without user involvement.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
-
Was able to auto update app using adb commands via su on a rooted device. – Harsh Jun 21 '15 at 03:36
-
Was able to auto update app using adb commands via su on a rooted device. – Harsh Jun 21 '15 at 03:37
0
this is possible, and don't need to be rooted. You only need to have a signed apk, and execute it in background.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(externalStorageDir, dir+ "APP.apk")),"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
The user will be prompted while installing, because we should inform the privileges of the app.

WiPe
- 1
- 3
0
Solved this issue. Final solution was it cannot be done phones which are not rooted. On rooted phone we can run adb script to do so. While on un rooted phone we can download the apk in background and launch the installer activity that will ask user to click once to approve installing the apk.

Harsh
- 599
- 3
- 20