1

I want to update my android application programmatically.

I used following code:

 final Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(Uri.fromFile(new 
       File(Environment.getExternalStorageDirectory()+"/AndroidTest.apk")), "application/vnd.android.package-archive");

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

This code display dialogue box to install application.

I want to install apk automatically.

Please help me.

Hemantvc
  • 2,111
  • 3
  • 30
  • 42

2 Answers2

5

Fortunately, this is not possible, for obvious security reasons. Apps cannot install apps without user intervention, with the exception of certain system apps that have the right permissions and such.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Yes It is possible Please check this out For this you need SUPER_USERACCESS Add this permission: <uses-permission android:name="android.permission.ACCESS_SUPERUSER" />

Sushant Gosavi
  • 3,647
  • 3
  • 35
  • 55