3

I'm developing an app for android in my company that will be running in a few tablets, if I make some changes I need to re-download and re-install my app in server manually. is there any way to do this automatically? I've search it, and this is what I've got;

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);    
        Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse("http://192.168.xxx.xxx/myApp.apk"));
        startActivity(intent);  
}

but it only download from my apk link, but it didn't install my apk, and everytime I open my app, It always download from my link, I want to make it only download when there's new app, and automatically install it.

Darjeeling
  • 959
  • 5
  • 19
  • 40

1 Answers1

4

We have a text file on the server containing the current release version (as an int) and the version number (eg 1.1.31)

Once a day the app will check load that data and compare to the current build number then prompt to download if the server version is higher. In your case you'd do the check first before calling the intent.

David O'Meara
  • 2,983
  • 25
  • 38
  • How do I check current release version and the version number? – Darjeeling Aug 29 '13 at 02:53
  • these are the values specified in the Android Manifest file. In your case you can probably just use the `versionCode` via `PackageInfo pInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), PackageManager.GET_META_DATA)` then `pInfo.versionCode` – David O'Meara Aug 29 '13 at 03:07