How to force uninstall application to update?


I made a mistake, which, apparently, can only be solved by uninstalling and then installing my application.

I delivered the message to users, but no one seems to be deleting it.

AFAIK, if I change the certificate file, the playback store will not allow me to download the application and I do not want to download the new application.

Is there a way to force delete for an update?

Thanks!

+4
source share
3 answers

There is no killswitch to remotely force a delete (this would be a security nightmare). What you can do is post a fixed version on Google Play and wait for users to update.

+3
source

Users should be able to go to Settings > Applications > Manage Applications and select the application to uninstall. I have never seen a case where an application cannot be removed in this way, except when embedded applications require a shortened device.

0
source

I do not know if this can help you, but I had the same problem. The solution for me is that I check the version of the application every time the user opens it and compares it with the version code stored on the apache server (in the checkversion.php file). If the versions do not match, I show a dialog without cancellation that asks the user to go to the market and download the update.

Here is an example (keep in mind that I use the Volley library to handle connections):

  public class UpdateManager { private Activity ac; private HashMap<String,String> params; public UpdateManager(Activity ac) { this.ac = ac; } public void checkForUpdates() { Log.d("UpdateManager","checkForUpdates() - Started..."); params = new HashMap<String,String>(); params.put("request","checkforupdates"); try { params.put("versioncode", String.valueOf(ac.getPackageManager().getPackageInfo(ac.getPackageName(), 0).versionCode)); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (Helper.isInternetAvailable(ac)) { //this is a class i made to check internet connection availability checkAppVersion(); } else { Log.d("UpdateManager","CheckForUpdates(): Impossible to update version due to lack of connection"); } } private void checkAppVersion() { Log.d("UpdateManager","checkAppVersion() - Request started..."); JsonObjectRequest req = new JsonObjectRequest("http://yourserver/checkappversion.php", new JSONObject(params), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { if (response != null && response.has("result")) { try { Log.d("UpdateManager","checkAppVersion() - Request finished - Response: "+response.getString("result")); if (response.getString("result").matches("updaterequested")) { //Update requested. Show the relative dialog Log.d("UpdateManager","Update requested"); askUserForUpdate(); } else if (response.getString("result").matches("current")) { //Same version. Do nothing Log.d("UpdateManager","Version is up to date"); } else if (response.getString("result").matches("error")) { //You can return an error message if error occurred on server Log.d("UpdateManager","checkappversion Error - "+response.getString("error")); } VolleyLog.v("Response:%n %s", response.toString(4)); } catch (JSONException e) { e.printStackTrace(); } } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("UpdateManager","Volley Error - "+error.getMessage()); } }); req.setRetryPolicy(new DefaultRetryPolicy(60000,0,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); ConnectionController.getInstance().addToRequestQueue(req); } public void askUserForUpdate() { final Dialog diag = new Dialog(ac); diag.requestWindowFeature(Window.FEATURE_NO_TITLE); diag.setContentView(R.layout.updatemanager_requestupdate_dialog); diag.setCancelable(false); diag.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); TextView t = (TextView)diag.findViewById(R.id.requestupdate_dialog_main_text); ImageView im_ok = (ImageView)diag.findViewById(R.id.requestupdate_dialog_ok); ImageView im_canc = (ImageView)diag.findViewById(R.id.requestupdate_dialog_canc); t.setText(ac.getResources().getString(R.string.update_manager_askuserforupdate)); im_canc.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { diag.dismiss(); ac.finish(); } }); im_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id="+ac.getPackageName())); diag.dismiss(); ac.startActivity(intent); ac.finish(); } }); diag.show(); } } 

You can then use it when your main action (or possibly input activity) starts as follows:

  UpdateManager updateManager = new UpdateManager(MainActivity.this); //i assume MainActicity as the calling activity updateManager.checkForUpdates(); 

Obviously, this should be implemented in the application code, so for the first time you have to rely only on the user to manually update it. But this may help if you have the same problem in the future.

This is an excerpt from my personal code, so you need to rearrange it according to your needs. Hope this helps someone.

0
source

All Articles