javiersantos / AppUpdater

A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 9+ required.
Apache License 2.0
1.98k stars 412 forks source link

Download Listener #147

Closed kervzcalub closed 5 years ago

kervzcalub commented 5 years ago

How to set button that downloads the app automatically? I mean, without going to browser. Or set an download listener

creativetrendsapps commented 5 years ago

@newbie-unknown something like this:

new AppUpdater(this) .setUpdateFrom(UpdateFrom.JSON) .setUpdateJSON(getResources().getString(R.string.up)) .setButtonUpdateClickListener((dialog, which) -> { if(!PreferencesUtility.hasStoragePermission(AppListActivity.this)){ PreferencesUtility.requestStoragePermission(AppListActivity.this); }else { downloadFile(getResources().getString(R.string.up_link)); } }) .start(); }

javiersantos commented 5 years ago

This library doesn't provide a way to download and install the update (it's not allowed by Google Play Store). You must implement it on your own using DownloadManager or similar.