您的位置:首页 > 移动开发 > Android开发

android 增量更新之客户端

2014-02-21 16:24 405 查看
最近工作需要学习了android的 增量更新,

使用demo方式如下

package com.leepood.bsdiff;

import com.leepood.bsdiff.tools.PatchTools;

import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String path= Environment.getExternalStorageDirectory().getPath() ;
PatchTools.applay_patch(path+"/old.apk", path+"/new.apk",
path+"/app.patch");
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}
工具类代码

package com.leepood.bsdiff.tools;

public class PatchTools {

static{
System.loadLibrary("patch_tools");
}

public native static int applay_patch(String oldPackage,String newPack,String patch);

}


如果 你已经有了ndk开发环境  可以自己下载源码编译  github 源码 点击下载

如果没有ndk开发环境  (在我的下载资源里面 刚刚上传)已经编译好的依赖包 (一个jar 一个.so),

引入jar后可直接调用方法 PatchTools.applay_patch(xx,xx,xx);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android 增量更新