-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
||
|
||
|