Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

self upgrading own apk via net programmatically on android

Tags:

android

apk

We have to port our software to android. One of the main feature of our software should be that the software can download a new version of itself from the net (our own server) and install it's new version too. All this thing should be done programmatically.

I'm new to android, so haven't got any clue how should it be done.

  • How to create apk? - solved
  • How to sign apk? - solved
  • How to download apk? - solved
  • How to copy the downloaded file overwriting /data/apk/my.software.name.apk? - unsolved
  • How to restart the software by the running version? - unsolved
like image 225
Barna Avatar asked Oct 21 '10 12:10

Barna


1 Answers

File file = new File(dir, "App.apk");

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");

startActivity(intent);

I had the same problem and after several attempts, it worked for me this way. Previously i got my new apk from a webservice.

like image 184
Horaceman Avatar answered Oct 20 '22 16:10

Horaceman