Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen for updates ans install from server

  1. First I have a server.I check server is there any new apk file I download this and try to install.
  2. If server have new version of apk file then I want to update my .apk file.
  3. I want to Install/update without user interaction.Is it possible?
  4. If user interaction is needed then How can I install/update .apk file.

I don't have idea much more about that.

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

But this is not working.WHen I debugging I can not see any mistake but it does not install.How can I do that.Sorry for bad English.

like image 681
Maidul Avatar asked Aug 31 '12 14:08

Maidul


1 Answers

I solved the issue this way.

String vsName=Environment.getExternalStorageDirectory().getAbsolutePath()+"/download/";
File file = new File(vsName, "jarviz.apk");
System.out.println(":"+file);
Intent install=new Intent(Intent.ACTION_VIEW);
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(install);
like image 174
Maidul Avatar answered Oct 18 '22 09:10

Maidul