Add the repository to your project build.gradle:
repositories {
maven {
url "https://jitpack.io"
}
}
Maven:
<dependency>
<groupId>com.github.atzcx</groupId>
<artifactId>AppVerUpdater</artifactId>
<version>1.0</version>
</dependency>
or Gradle:
compile 'com.github.atzcx:AppVerUpdater:1.0'
Add permissions to your app's Manifest:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Activity and Fragment
new AppVerUpdater(MainActivity.this)
.setJSONUrl("http://example.com/update.json")
.setDialogTitle("Availabe a new update!")
.setDialogContent("Update %s mobile app to version %s \nFeatures: \n%s")
.setDialogPositiveText("Update")
.setDialogNegativeText("Later")
.setProgressDialogMessage("Download updates...")
.build();
{
"newVersion": "4.4.0",
"apkUrl": "https://example.net/example.apk",
"versionNotes": [
"- Bug fixes"
]
}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.