0
Google play apps updating without the need to uninstall. Does anyone know how the google update works? Thanks in advance.
0
Google play apps updating without the need to uninstall. Does anyone know how the google update works? Thanks in advance.
1
You can use this:
protected String doInBackground(String... sUrl) {
String path = "/sdcard/YourApp.apk";
try {
URL url = new URL(sUrl[0]);
URLConnection connection = url.openConnection();
connection.connect();
int fileLength = connection.getContentLength();
// download the file
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream(path);
byte data[] = new byte[1024];
long total = 0;
int count;
while ((count = input.read(data)) != -1) {
total += count;
publishProgress((int) (total * 100 / fileLength));
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();
} catch (Exception e) {
Log.e("YourApp", "Well that didn't work out so well...");
Log.e("YourApp", e.getMessage());
}
return path;
}
// begin the installation by opening the resulting file
@Override
protected void onPostExecute(String path) {
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive" );
Log.d("Lofting", "About to install new .apk");
this.context.startActivity(i);
}
What is this code doing? It doesn’t seem to have to do with the question.
Hello @Diego F, This code is downloading from the server and later doing the apk installation without removing the previous one.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
Want to know how to update by google play?
– Thiago Luiz Domacoski
apk if it has the same name as the already installed android installation manager will already suggest the update, that’s what I wanted to ask?
– Danilo