App Upgrade: Android java Demo App is a sample android app written in Java integrated with App Upgrade Android SDK to demonstrate how Force upgrade works in android app with App Upgrade.
You can find the android java demo app integrated via API in integrate-via-api branch.
You can find Kotlin version here
To get started, clone the repo:
$ git clone https://github.com/appupgrade-dev/app_upgrade_android_java_demo_app
-
Open the directory in Android Studio.
-
Open the
app_upgrade_android_java_demo_app\app\src\main\java\com\appupgrade\app_upgrade_android_java_demo_app\MainActivity.java
file, and replace required values in line 21-27Key Value Description xApiKey
Your API Key. Required. appName
Your app name. Required. appVersion
Your app version. Required. platform
Your app platform, ex: android or iOS. Required. environment
Your app environment, ex: dev, stating, production. Required. appLanguage
Your app language, ex: en, es. Nullable. preferredAndroidMarket
Your preferred android market, ex: amazon, huawei or other. Optional. otherAndroidMarketUrl
Other market place url from where update can be done. Optional. Required only if PreferredAndroidMarket is other
If you want users to redirect to store other than app store or playstore. You can add these additional parameters in appInfo
-
preferredAndroidMarket: PreferredAndroidMarket.AMAZON // or PreferredAndroidMarket.HUAWEI or PreferredAndroidMarket.OTHER If not provided default is Google playstore. If you want to redirect user to some other android market place you can add the following fields:
-
preferredAndroidMarket: PreferredAndroidMarket.OTHER
-
otherAndroidMarketUrl: 'https://someotherandroidmarket.com/app/id'// Required if preferredAndroidMarket is other.
-
Save
MainActivity.java
file. -
Run the app.
- Head to App Upgrade and signup if not already.
- Create a new Project.
- Grab the API Key. You will need to provide the same in the required fields mentioned in above section.
- Create a new version with the required details and force upgrade field as selected. Make sure the details provided in version matches with the details provided in the App.js file.
- Refresh the app and you will be able to see a popup for force upgrade.
- Edit the version in dashboard with Force upgrade field unselected. Refresh the app and you will see a popup with soft upgrade with a button to upgrade later.
For full details on how to use App Upgrade dashboard read our Documentation
If you are using minifyEnabled true
it may obfuscate the code. Add the following rule in proguard-rules.pro to make sure SDK shows the popup.
# Keep all classes in the App Upgrade SDK package
-keep class com.appupgrade.app_upgrade_android_sdk.** { *; }
If you're looking for help, try our Documentation or our FAQ. If you need support please write to us at support@appupgrade.dev