IBM MobileFirst 检测应用程序版本更新

IBM MobileFirst Detect Application Version Update

版本更新时,用户打开应用后会收到更新通知,会弹出更新提示框,he/she可选择"Update"或"Cancel"更新请求。

如何检测用户选择的操作(Update/Cancel)?

如果使用产品默认提供的功能,则不能。

为了做到这一点 "detection",您需要实施自定义直接更新,但听起来您的情况不需要完全自定义,因此您可以查看以下内容"customizing the UI" 下的示例:https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/advanced-client-side-development/using-direct-update-to-quickly-update-your-application/#userExprience

在示例代码中,有启动或取消更新过程的额外代码,因此您可以在此处向 "know" 添加额外代码以启动或取消更新过程。

wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData,
directUpdateContext) {
    // custom WL.SimpleDialog for Direct Update
    var customDialogTitle = 'Custom Title Text';
    var customDialogMessage = 'Custom Message Text';
    var customButtonText1 = 'Update Application';
    var customButtonText2 = 'Not Now';

    WL.SimpleDialog.show(customDialogTitle, customDialogMessage,
        [{
            text : customButtonText1,
            handler : function() {
                directUpdateContext.start();
                // Additional code here.
            }
        },
        {
            text : customButtonText2,
            handler : function() {
                wl_directUpdateChallengeHandler.submitFailure();
                // Additional code here.
            }
        }]
    );
};