Last active
March 30, 2020 02:31
-
-
Save sismetanin/861a55769dcb637db220e53cfde44fc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create instance of the IAU manager. | |
val appUpdateManager = AppUpdateManagerFactory.create(context) | |
// Add state listener to app update info task. | |
appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo -> | |
// If there is an update available, prepare to promote it. | |
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE | |
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { | |
// ... | |
} | |
// If the process of downloading is finished, start the completion flow. | |
if (appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED) { | |
// ... | |
} | |
} | |
.addOnFailureListener { e -> | |
// Handle the error. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// إنشاء مثيل لمدير IAU.
val appUpdateManager = AppUpdateManagerFactory .create (سياق)
// إضافة مستمع حالة إلى مهمة معلومات تحديث التطبيق.
appUpdateManager.appUpdateInfo.addOnSuccessListener {appUpdateInfo - >
// إذا كان هناك تحديث متاح ، فاستعد للترويج له.
if (appUpdateInfo.updateAvailability () == UpdateAvailability . UPDATE_AVAILABLE
&& appUpdateInfo.isUpdateTypeAllowed ( AppUpdateType . FLEXIBLE )) {
// ...
}}
}}
.addOnFailureListener {e - >
// معالجة الخطأ.
}}