-1

I have a program which only works if you have registration information. I don't put it on google play because if people downloaded the program and installed it and couldn't use it, I assume I would get low votes.

So instead I have a webpage where I can download the .apk file and then do an install. My question is in regards to how to do updates for the program in a smooth process.

The issue I've had is between my minor version that when I download the newer apk file that the android OS appends -1 then -2 then -3 to the download names. This is fine, however I've noticed some phones have issues installing apks with the -s in them. So I have to go into a file management program and then rename the files then I can install without an issue. This is however beyond the technical scope I would have for a normal user.

Ideally, I would like to make the upgrade process easy, perhaps from the app itself. Is this possible? I control the webserver so, I can have a file sitting there that shows the latest version so the program can know when it can upgrade and the apk it needs to download to do the upgrade. I just don't know if I need to specify particular intents in my program to allow for an upgrade controlled by android or if I download the file then launch it, and if I do if I upgrade the program while it is running. E.g. Windows normally does locks on the .exe files so you can't do this.

Kara
  • 6,115
  • 16
  • 50
  • 57
James Oravec
  • 19,579
  • 27
  • 94
  • 160
  • If anyone is interested on how to do a nice download for the upgrade, I would recommend: http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog – James Oravec Nov 13 '13 at 16:47

1 Answers1

1

Your application could periodically query your web server to check for and download an updated .apk file. Once a new download is updated, you can prompt your user to install it with the following intent:

String updatedFile = "PATH_TO_APK";
Intent intent = new Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.fromFile(new File(updatedFile)), "application/vnd.android.package-archive");
startActivity(intent); 

Read more here. You could rename the file inside the application before installing to overcome the naming issue on certain phones.

ashatte
  • 5,442
  • 8
  • 39
  • 50