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,071
  • 3
  • 29
  • 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
  • 954,112
  • 185
  • 2,315
  • 2,367
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,272
  • 3
  • 30
  • 50