15

I have an android app written for my company and since its a private app, it is not in the android market. I'd like to be able to have the app check periodically for an update and if there is one notify the user and start downloading / installing the update.

Is there an example of something like this out there?

Mike
  • 251
  • 3
  • 5

2 Answers2

9

at the start of your app check the available version, the you can use an AlertDialog to ask for the upgrade.

Read this:: Is there a way to automatically update application on Android?

and this is an AlertDialog example::

    if (ConfigXML_app_version> myapp_version){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Upgrade");
        builder.setMessage("Update available, ready to upgrade?");
        builder.setIcon(R.drawable.icon);
        builder.setCancelable(false);
        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(app_link));
                startActivity(intent);               
                finish();
            }
        });
        builder.setNegativeButton("Nop", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();

    }
Community
  • 1
  • 1
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • This is way old, but for everyone's future reference, when an answer solves your problem, it is customary to mark it as the accepted answer. – Erhannis Feb 21 '14 at 21:20
  • This intent Only downloads the new version of my apk .I need to open an installation popup – vimal1083 Mar 03 '14 at 06:49
0

Pushlink (https://www.pushlink.com) aims make your enterprise application update itself without third-party libraries. You can also use some of the update strategies like status bar, popups or silent updates for rooted devices.

Victor Hugo Bueno
  • 267
  • 1
  • 4
  • 9