Android Smart Updates is an Open Source library that makes patch way update(using bsdiff) in android easily.
And server is base on Ruby on Rails.
Link to server source code AndroidSmartUpdatesServer
Link to AndroidSmartUpdatesDemo
Using IntelliJ:
- import the AndroidSmartUpdates as a module into your project.
- add AndroidSmartUpdates into module dependency for your main module.
- create an application in AndroidSmartUpdatesServer,and mark down the App ID.
- copy the files in the folder libs your main module directory.
- add below permission in your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
4、add these codes to your activity's entrance.
smartUpdates = new SmartUpdates(this); smartUpdates.setServerAddress("http://www.xxx.com/"); smartUpdates.setApplicationId(YOUR_APP_ID); smartUpdates.checkForUpdate();
fill YOUR_APP_ID with App Id in step 1
You can use the UpdateListener
smartUpdates.setShowUpdateDialog(false); smartUpdates.setUpdateListener(updateListener); smartUpdates.checkForUpdate(); private UpdateListener updateListener = new UpdateListener() { @Override public void hasUpdate(PatchInformation information) { Toast.makeText(context, "has update, version:" + information.getVersionName(), Toast.LENGTH_LONG).show(); // start to update. smartUpdates.startUpdate(); } @Override public void hasNoUpdate() { Toast.makeText(context, "no update", Toast.LENGTH_LONG).show(); } };
A student from SCAU China.
Email: specialcyci#gmail.com