11<p align =" center " >
2- <img src =" https://raw.githubusercontent.com/SirLordPouya/AndroidAppUpdater/master/pics/icon.png " width =" 250 " >
2+ <img src =" https://raw.githubusercontent.com/SirLordPouya/AndroidAppUpdater/master/pics/icon.png " width =" 250 " >
33</p >
44
55# Android App Updater
66
7- [ ![ Android Arsenal] ( https://img.shields.io/badge/Android%20Arsenal-Easy%20App%20Updater-brightgreen.svg?style=flat )] ( https://android-arsenal.com/details/1/7388 )
8- [ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/7e8f094fd77044b5b26bc6c157bfbbc3 )] ( https://app.codacy.com/gh/SirLordPouya/AndroidAppUpdater/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade )
9- [ ![ ] ( https://jitpack.io/v/SirLordPouya/AndroidAppUpdater.svg )] ( https://jitpack.io/#SirLordPouya/AndroidAppUpdater )
10- [ ![ API] ( https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat )] ( https://android-arsenal.com/api?level=16 )
11- [ ![ ktlint] ( https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg )] ( https://ktlint.github.io/ )
7+ [ ![ Android Arsenal] ( https://img.shields.io/badge/Android%20Arsenal-Easy%20App%20Updater-brightgreen.svg?style=flat )] ( https://android-arsenal.com/details/1/7388 ) [ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/7e8f094fd77044b5b26bc6c157bfbbc3 )] ( https://app.codacy.com/gh/SirLordPouya/AndroidAppUpdater/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade ) [ ![ ] ( https://jitpack.io/v/SirLordPouya/AndroidAppUpdater.svg )] ( https://jitpack.io/#SirLordPouya/AndroidAppUpdater ) [ ![ API] ( https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat )] ( https://android-arsenal.com/api?level=16 ) [ ![ ktlint] ( https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg )] ( https://ktlint.github.io/ )
128
13- App Updater is an easy-to-use and fully customizable library to show update dialog to users.
14- The update dialog can contain different app stores or direct download links. It can be used as a ** FragmentDialog** or ** Composable** .
9+ Android App Updater is a simple yet powerful library for displaying an update dialog in your app. It supports multiple app stores and direct download links. You can use it as a ** DialogFragment** or a** Composable** component.
1510
1611<p align =" center " >
17- <img src =" https://raw.githubusercontent.com/SirLordPouya/AndroidAppUpdater/master/pics/header.png " width =" 800 " >
12+ <img src =" https://raw.githubusercontent.com/SirLordPouya/AndroidAppUpdater/master/pics/header.png " width =" 800 " >
1813</p >
1914
20- ## Usage
21-
22- ### Available stores
23-
24- The library currently supports bellow markets:
25-
26- | App Store Name | App Store Enum |
27- | -------------------------------------------------------------------------| ----------------------------|
28- | [ Google Play] ( https://play.google.com ) | Store.GOOGLE_PLAY |
29- | [ Huawei App Gallery] ( https://appgallery.huawei.com/ ) | Store.HUAWEI_APP_GALLERY |
30- | [ Samsung Galaxy Store] ( https://www.samsung.com/de/apps/galaxy-store/ ) | Store.SAMSUNG_GALAXY_STORE |
31- | [ Amazon App Store] ( https://www.amazon.com/gp/mas/get/amazonapp ) | Store.AMAZON_APP_STORE |
32- | [ Xiaomi GetApp Market] ( https://global.app.mi.com/ ) | Store.MI_GET_APP_STORE |
33- | [ Oppo App Market] ( https://oppomobile.com/ ) | Store.OPPO_APP_MARKET |
34- | [ F-Droid App Store] ( https://f-droid.org/ ) | Store.FDROID |
35- | [ Aptoide App Store] ( https://en.aptoide.com/ ) | Store.APTOIDE |
36- | [ OneStore App Market] ( https://m.onestore.co.kr/mobilepoc/main/main.omp ) | Store.ONE_STORE_APP_MARKET |
37- | [ Vivo V-AppStore] ( https://developer.vivo.com/home ) | Store.V_APP_STORE |
38- | [ 9-Apps Market] ( https://www.9apps.com/ ) | Store.NINE_APPS_STORE |
39- | [ ZTE App Center] ( https://apps.ztems.com/ ) | Store.ZTE_APP_CENTER |
40- | [ Lenovo App Center] ( https://www.lenovomm.com ) | Store.LENOVO_APP_CENTER |
41- | [ Tencent App Store] ( https://appstore.tencent.com/ ) | Store.TENCENT_APPS_STORE |
42- | [ Cafe Bazaar Store] ( https://cafebazaar.ir ) | Store.CAFE_BAZAAR |
43- | [ Myket App Store] ( https://myket.ir/ ) | Store.MYKET |
44-
45- ### Showing stores
46-
47- If you provide your application on above mentioned stores, you can list all of them in the update
48- dialog.
49- To create a new store:
15+ ## 🚀 Installation
16+
17+ ### Step 1: Add JitPack Repository
18+
19+ Add the following to your project's ** build.gradle.kts** :
5020
5121``` kotlin
52- val list = arrayListOf<StoreListItem >()
53- list.add(
54- StoreListItem (
55- store = Store .GOOGLE_PLAY ,
56- title = " Store Title" ,
57- icon = R .drawable.appupdater_ic_google_play,
58- url = " https://url/to/your/website" ,
59- packageName = " YOUR_APPS_PACKAGE_NAME"
60- )
61- )
22+ allprojects {
23+ repositories {
24+ maven(" https://jitpack.io" )
25+ }
26+ }
6227```
6328
64- Parameters of StoreListItem, in order:
29+ ### Step 2: Add Dependencies
30+
31+ ``` kotlin
32+ // For standard Android projects
33+ implementation(" com.github.SirLordPouya.AndroidAppUpdater:main:latest_version" )
34+
35+ // For Jetpack Compose integration
36+ implementation(" com.github.SirLordPouya.AndroidAppUpdater:compose:latest_version" )
37+ ```
38+
39+ ## 🎯 Supported App Stores
40+
41+ The library supports the following app stores:
6542
66- | order | Parameter Name | Parameter Type | Description |
67- | -------| ----------------| ----------------| ----------------------------------------------------------------------------|
68- | 1 | store | Store | Store Enum (e.g. GOOGLE_PLAY, CAFE_BAZAAR, ...) |
69- | 2 | title | String | Title of the store that user sees |
70- | 3 | icon | Int | Icon of the store that user sees |
71- | 4 | url | String | An url to open in a webview if the store is not installed in user's device |
72- | 5 | packageName | String | Package name of the application on the store |
43+ | Store | Enum |
44+ | ----------------------| -----------------------------------|
45+ | Google Play | AppStoreType.GOOGLE_PLAY |
46+ | Huawei App Gallery | AppStoreType.HUAWEI_APP_GALLERY |
47+ | Samsung Galaxy Store | AppStoreType.SAMSUNG_GALAXY_STORE |
48+ | Amazon App Store | AppStoreType.AMAZON_APP_STORE |
49+ | Xiaomi GetApp Market | AppStoreType.MI_GET_APP_STORE |
50+ | Oppo App Market | AppStoreType.OPPO_APP_MARKET |
51+ | F-Droid | AppStoreType.FDROID |
52+ | Aptoide | AppStoreType.APTOIDE |
53+ | OneStore | AppStoreType.ONE_STORE_APP_MARKET |
54+ | Vivo V-AppStore | AppStoreType.V_APP_STORE |
55+ | 9-Apps Market | AppStoreType.NINE_APPS_STORE |
56+ | ZTE App Center | AppStoreType.ZTE_APP_CENTER |
57+ | Lenovo App Center | AppStoreType.LENOVO_APP_CENTER |
58+ | Tencent App Store | AppStoreType.TENCENT_APPS_STORE |
59+ | Cafe Bazaar | AppStoreType.CAFE_BAZAAR |
60+ | Myket | AppStoreType.MYKET |
7361
74- *** You can omit adding some properties in Kotlin:***
62+ ## 📌 Usage
63+
64+ ### Defining App Stores
65+
66+ To add stores where users can update the app:
7567
7668``` kotlin
77- list.add (
69+ val storesList = listOf (
7870 StoreListItem (
79- store = Store . GOOGLE_PLAY ,
71+ store = StoreFactory .getStore( AppStoreType . GOOGLE_PLAY , " YOUR_APP_PACKAGE " ) ,
8072 title = " Google Play" ,
81- packageName = " YOUR_APPS_PACKAGE_NAME "
73+ icon = R .drawable.appupdater_ic_google_play
8274 )
8375)
8476```
8577
86- ### Direct Download
78+ ### Adding a Direct Download Link
8779
88- You can also make as many direct APK download links as you need. Users can download the APK directly
89- on their phone.
90- After downloading finishes, the install page will be shown to the user automatically.
80+ Add these permissions to your ` AndroidManifest.xml ` :
81+
82+ ``` xml
83+
84+ <uses-permission android : name =" android.permission.INTERNET" />
85+ <uses-permission android : name =" android.permission.WRITE_EXTERNAL_STORAGE" />
86+ <uses-permission android : name =" android.permission.REQUEST_INSTALL_PACKAGES" />
87+ ```
88+
89+ Then, add a direct download link:
9190
9291``` kotlin
93- list.add(
94- StoreListItem (
95- store = Store .DIRECT_URL ,
92+ val directDownloadLinksList = listOf (
93+ DirectDownloadListItem (
9694 title = " Direct Download" ,
97- url = " https://cafebazaar.ir/download/bazaar .apk"
95+ url = " https://example.com/app .apk"
9896 )
9997)
10098```
10199
102- *** Remember to put WRITE_EXTERNAL_STORAGE, INTERNET and REQUEST_INSTALL_PACKAGES permissions in your
103- manifest. The library asks for these permissions at runtime if needed***
100+ ### Showing the Update Dialog
104101
105- ## Show UpdateDialog with Jetpack Compose
106-
107- You can show a native compose UpdateDialog to the user:
102+ #### ✅ Using Jetpack Compose
108103
109104``` kotlin
110- AndroidAppUpdaterTheme {
105+ var shouldShowDialog by remember { mutableStateOf(true ) }
106+
107+ if (shouldShowDialog) {
111108 AndroidAppUpdater (
112- UpdaterDialogData (
113- dialogTitle = " New Update !" ,
114- dialogDescription = " Lots of new features! Update right now" ,
115- storeList = list,
116- theme = Theme .DARK
109+ dialogData = UpdaterDialogData (
110+ dialogTitle = " New Update Available" ,
111+ dialogDescription = " We've fixed bugs and improved performance!" ,
112+ dividerText = " Or" ,
113+ storeList = storesList,
114+ directDownloadList = directDownloadLinksList,
115+ onDismissRequested = { shouldShowDialog = false },
116+ errorWhileOpeningStoreCallback = { storeName -> /* Handle error */ },
117+ theme = Theme .LIGHT
117118 )
118119 )
119120}
120121```
121122
122- Parameters in the UpdaterDialogData in order are:
123-
124- | order | Parameter Name | Parameter Type | Description |
125- | -------| --------------------| ------------------------| ----------------------------------------------------------------------------------------------------|
126- | 1 | dialogTitle | String | Title of the update dialog |
127- | 2 | dialogDescription | String | Description of the update dialog |
128- | 3 | storeList | List<UpdaterStoreList > | List of Stores and Direct links to be shown to the user in the update dialog | | | |
129- | 4 | onDismissRequested | () -> Unit | Gets invoked when the user requests to dismiss the dialog |
130- | 5 | typeface | Typeface? | Typeface to customize the font style if needed (You can omit this parameter if you don 't need it) | | | |
131- | 6 | theme | Theme | Theme of the dialog (can be set to Theme.Light, Theme.Dark or Theme.SYSTEM_DEFAULT) |
132-
133- ### Show UpdateDialog with Fragments
123+ #### ✅ Using Fragments
134124
135125``` kotlin
136- AppUpdaterDialog .getInstance(
137- UpdaterDialogData (
138- title = " New Update !" ,
139- description = " Lots of new features! Update right now" ,
140- storeList = list,
141- isForceUpdate = false ,
142- typeface = typeface,
143- theme = Theme .LIGHT
144- )
145- ).show(supportFragmentManager, TAG )
146- ```
126+ val data = UpdaterDialogData (
127+ title = " New Update Available" ,
128+ description = " We've fixed bugs and improved performance!" ,
129+ storeList = storesList,
130+ directDownloadList = directDownloadLinksList,
131+ isForceUpdate = false ,
132+ errorWhileOpeningStoreCallback = { storeName -> /* Handle error */ },
133+ theme = Theme .SYSTEM_DEFAULT ,
134+ )
147135
148- Parameters in the UpdaterDialogData in order are:
136+ AppUpdaterDialog .getInstance(data).show(supportFragmentManager, " UPDATE_DIALOG" )
137+ ```
149138
150- | order | Parameter Name | Parameter Type | Description |
151- | -------| ----------------| ------------------------| ---------------------------------------------------------------------------------------------------|
152- | 1 | title | String | Title of the update dialog |
153- | 2 | description | String | Description of the update dialog |
154- | 3 | storeList | List<UpdaterStoreList > | List of Stores and Direct links to be shown to the user in the update dialog |
155- | 4 | isForceUpdate | Boolean | Makes the dialog non-cancelable if sets to true |
156- | 5 | typeface | Typeface? | Typeface to customize the font style if needed (You can omit this parameter if you don't need it) |
157- | 6 | theme | Theme | Theme of the dialog (can be set to Theme.Light, Theme.Dark or Theme.SYSTEM_DEFAULT) |
139+ ## 🎨 Customization
158140
159- ### Customizing dialog texts
141+ ### Overriding Default Texts
160142
161- If you need to customize any texts in the updater or the update in progress dialogs, you can add
162- these strings resources in your strings.xml file to override them:
143+ Modify ` strings.xml ` to customize text:
163144
164145``` xml
165146
@@ -174,94 +155,11 @@ these strings resources in your strings.xml file to override them:
174155</resources >
175156```
176157
177- ### Default icons
158+ ## 📝 License
178159
179- There are default icons of all stores included in the library. You can use them or use your own icons.
180- Here is the list of icon names for each store:
181-
182- | Market Name | Icon name |
183- | ----------------------| --------------------------------------------|
184- | Google Play | R.drawable.appupdater_ic_google_play |
185- | Huawei App Gallery | R.drawable.appupdater_ic_app_gallery |
186- | Samsung Galaxy Store | R.drawable.appupdater_ic_galaxy_store |
187- | Amazon App Store | R.drawable.appupdater_ic_amazon_app_store |
188- | Xiaomi GetApp Store | R.drawable.appupdater_ic_get_app_store |
189- | Oppo App Market | R.drawable.appupdater_ic_oppo_app_market |
190- | F-Droid App Store | R.drawable.appupdater_ic_fdroid |
191- | Aptoide App Store | R.drawable.appupdater_ic_aptoide |
192- | OneStore App Market | R.drawable.appupdater_ic_one_store |
193- | Vivo V-AppStore | R.drawable.appupdater_ic_v_app_store |
194- | 9-Apps Market | R.drawable.appupdater_ic_nine_apps |
195- | ZTE App Center | R.drawable.appupdater_ic_zte_app_center |
196- | Lenovo App Center | R.drawable.appupdater_ic_lenovo_app_center |
197- | Tencent App Store | R.drawable.appupdater_ic_tencent_app_store |
198- | Cafe Bazaar Store | R.drawable.appupdater_ic_bazar |
199- | Myket App Store | R.drawable.appupdater_ic_myket |
200-
201- *** Note: Don't forget to add import for drawables <import com.pouyaheydari.appupdater.R.\* >***
202-
203- ## Using library in Kotlin DSL style
204-
205- This library also supports DSL.
206-
207- ### Adding Stores in DSL
208-
209- ``` kotlin
210- val list = listOf (
211- store {
212- store = Store .GOOGLE_PLAY
213- title = " Store Title"
214- icon = R .drawable.appupdater_ic_google_play
215- url = " https://url/to/your/website"
216- packageName = " YOUR_APPS_PACKAGE_NAME"
217- })
218- ```
219-
220- ### Showing UpdateDialog in DSL
221-
222- ``` kotlin
223- updateDialogBuilder {
224- title = " New Update !"
225- description = " Lots of new features! Update right now"
226- isForceUpdate = false
227- typeface = Typeface .createFromAsset(assets, FONT_PATH )
228- theme = Theme .DARK
229- list = list
230- }.show(supportFragmentManager, TAG )
231- ```
232-
233- ** Check the demo application to see it in your IDE.**
234-
235- ## Download
236-
237- ### Adding the dependency
238-
239- Add this to your root ** build.gradle** file:
240-
241- ``` kotlin
242- allprojects {
243- repositories {
244- maven(" https://jitpack.io" )
245- }
246- }
247160```
248-
249- Then add these dependencies to your app build.gradle file:
250-
251- ``` kotlin
252-
253- // To use the library in Kotlin, Kotlin DSL or Java
254- implementation(" com.github.SirLordPouya.AndroidAppUpdater:main:latest_version" )
255-
256- // To use the library with Jetpack Compose
257- implementation(" com.github.SirLordPouya.AndroidAppUpdater:compose:latest_version" )
258- ```
259-
260- ## License
261-
262- ``` text
263161Android App Updater is released under the Apache License 2.0. See LICENSE for details.
264162Copyright (c) 2018 Pouya Heydari
265163```
266164
267- #### < div >Library's icon and style is designed by <a href =" https://dribbble.com/Amirgk " title =" Amir Gerdakane " >Amir Gerdakane</a >
165+ < p align = " center " >Library icon and design by <a href =" https://dribbble.com/Amirgk " title =" Amir Gerdakane " >Amir Gerdakane</a ></ p >
0 commit comments