Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gypnick authored Nov 29, 2017
1 parent f3d0617 commit 5e2bed7
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# updateapk
## 1.导入到工程
#### Step 1.Add it in your root build.gradle at the end of repositories:
```Java
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
#### Step 2. Add the dependency
```Java
dependencies {
compile 'com.github.gypnick:updateapk:V1.1'
}
```
## 2.使用
####
UpdateService.Builder.create(url) //url为下载apk的地址
.setVersionCode(2) //这里设置服务器上的版本,通过这里来和本地versionCode版本对比
.setIsForce(true) //是否强制更新,强制更新用户不更新就强制退出APP
.build(MainActivity.this);

# android7.0需要添加以下文件
### 1.在 AndroidManifest.xml中加入
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
### 2.在 /src/main/res/xml/ 加入file_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path path="Android/data/你的包名/" name="files_root" />
<external-path path="." name="external_storage_root" />
</paths>



0 comments on commit 5e2bed7

Please sign in to comment.