- To add this library to your app, initially download the ForceUpdate library to the root folder of your app.
- Add the following line to your settings.gradle file
include ':app',':forceupdate' - Now go to app build.gradle and add the following line.
implementation project(':forceupdate') - Sync library and you're good to go.
Initiate ForceUpate class in your MainActivity
ForceUpdate forceUpdate = new ForceUpdate(MainActivity.this);
forceUpdate.setCanceledOnTouchOutside(false);
forceUpdate.setTitle("New Update Available");
forceUpdate.setMessage("Download this Update for New Features");
forceUpdate.build();
Available Methods in this ForceUpdate Class:
Upadte Dialog dismiss when user touches the ui other than dialog.
setCanceledOnTouchOutside(boolean canceledOnTouchOutside)
Dialog will dismiss only if user taps any one of the button.
setCanceled(boolean canceled)
Set custom title for the Update Dialog.
setTitle(String title)
Set Custom Message to show to the user.
setMessage(String message)
Sample Screenshot:
Note:
- This library will work only when the application is connected to the internet.
- Internet permissions are already added to the library manifest file.