- Notifications
You must be signed in to change notification settings - Fork43
Android App Update Library can be used for downloading the Apk from a link , Save it to External or Internal Storage, Than automatic installing the apk. Remember to add provider xml and android runtime permission before using this library. See sample use in app folder.
License
Piashsarker/AndroidAppUpdateLibrary
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Android App Update Library can be used for downloading the Apk from a link , Save it to External or Internal Storage, Than automatic installing the apk. Remember to add provider xml and android runtime permission before using this library. See sample use in app folder.
Version: 1.0.4- Updated dependencies (upgrade to AndroidX) (df0ce1a)- Fixed failed install on lower Android versions (4603d10)- Rewrite to Kotlin (8d32d31)- Fixed calcualtion of download percentage (42e4dbb)- Made installation possible on higher Android versions (8a9be2e)- New optional file name parameter (fe4c1ab)
Thanks to @cyb3rko
Version : 1.0.3Update Target SDK Version To 27 ( Android Oreo)Added Permission For Package Install For Android Oreo.
Add it in your project level root build.gradle at the end of repositories:
allprojects {repositories {...maven { url 'https://jitpack.io' }}}
dependencies { implementation 'com.github.Piashsarker:AndroidAppUpdateLibrary:1.0.4'}
Remember to add below permission inManifest.xml file
. And Also add runtime permission for (Version => Marshmallow ). See the sample app.
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
Create a folder calledxml
inres
folder. Create a xml file and named itprovider_paths
. Paste below code:
<?xml version="1.0" encoding="utf-8"?><paths xmlns:android="http://schemas.android.com/apk/res/android"><external-path name="external_files" path="."/></paths>
Add below code in yourAndroidManifest.xml
file.
<application .............. <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/> </provider></application>
After setting up all neccessary files it's just two line of code to download and install the apk updates in your device.
String url = "https://github.com/Piashsarker/AndroidAppUpdateLibrary/raw/master/app-debug.apk";DownloadApk downloadApk = new DownloadApk(MainActivity.this); // With standard fileName 'App Update.apk'downloadApk.startDownloadingApk(url);// With custom fileName, e.g. 'Update 2.0'downloadApk.startDownloadingApk(url, "Update 2.0");
You are Good To Go. Happy Coding
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
About
Android App Update Library can be used for downloading the Apk from a link , Save it to External or Internal Storage, Than automatic installing the apk. Remember to add provider xml and android runtime permission before using this library. See sample use in app folder.