InApp update library for Android, In-app update is a library a new request flow to prompt active users to update your app.
In-app updates works only with devices running Android 5.0 (API level 21) or higher, and requires you to use Play Core library 1.5.0 or higher. Additionally, in-app updates support apps running on only Android mobile devices and tablets, and Chrome OS devices.
In build.gradle (Project)
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
And then in the other gradle file(may be your app gradle or your own module library gradle, but never add in both of them to avoid conflict.)
dependencies {
...
implementation 'com.github.myinnos:Android-InApp-Update:BETA-0.2'
implementation 'com.google.android.play:core:1.7.2' //to initiate AppUpdateManager
}
Step 1: Initiate AppUpdateManager in MainActivity:
private AppUpdateManager appUpdateManager;
.....
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
.............
appUpdateManager = AppUpdateManagerFactory.create(this);
InAppUpdate.setImmediateUpdate(appUpdateManager, this);
}
Step 2: Add function in onResume.
@Override
protected void onResume() {
super.onResume();
InAppUpdate.setImmediateUpdateOnResume(appUpdateManager, this);
}
optional/add-ons: onActivityResult/strings/colors
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == InAppUpdate.REQUEST_APP_UPDATE){
........
}
}
// strings [For Flexibale Update]
<string name="in_app_snack_bar_message">Update almost finished!</string>
<string name="in_app_snack_bar_action_title">RESTART</string>
// colors [For Flexibale Update]
<color name="in_app_snack_bar_text_color">#37474F</color>
After meeting these requirements, your app can support the following UX for in-app updates:
A full screen user experience that requires the user to update and restart the app in order to continue using the app. This UX is best for cases where an update is critical for continued use of the app. After a user accepts an immediate update, Google Play handles the update installation and app restart.
A user experience that provides background download and installation with graceful state monitoring. This UX is appropriate when it’s acceptable for the user to use the app while downloading the update. For example, you want to urge users to try a new feature that’s not critical to the core functionality of your app.
Any Queries? or Feedback, please let me know by opening a new issue!
- 🌐 Website: myinnos.in
- 📧 e-mail: contact@myinnos.in
- 🔎 LinkedIn: PrabhakarThota
- 👍 Twitter: @myinnos
- 📷 Instagram: @prabhakar_t_
If you appreciate my work, consider buying me a cup of ☕ to keep me recharged 🤘 by PayPal
Copyright 2020 MyInnos
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.