Skip to content

[Android] Update with InstallMode.IMMEDIATE not applied until manual app restart #31

@Abhishek-Appstn

Description

@Abhishek-Appstn

on update it doesnot reflect the change code in the immediate boot, if i rebooot it manually it works, this issue is seen only in android
Environment
@code-push-next/react-native-code-push version: 1.2.0

react-native version: 0.81.1

code
useEffect(() => {
codePush.notifyAppReady();
}, []);

useEffect(() => {

    try {
        codePush.sync(
            {
                installMode: codePush.InstallMode.IMMEDIATE,
                deploymentKey: codePushKey
            },
            codePushStatusDidChange,
            codePushDownloadDidProgress
        );
    } catch (error) {
        console.warn('error', error);
    }

}, []);
const codePushStatusDidChange = (syncStatus: codePush.SyncStatus) => {

    switch (syncStatus) {
        case codePush.SyncStatus.CHECKING_FOR_UPDATE:
            setStatus('Checking for Updates');
            break;
        case codePush.SyncStatus.DOWNLOADING_PACKAGE:
            setStatus('Downloading Updates');
            break;
        case codePush.SyncStatus.INSTALLING_UPDATE:
            setStatus('Installing Updates');
            break;
        case codePush.SyncStatus.UP_TO_DATE:
            setStatus('Up to Date');
            setVisible(false);
            setTimeout(() => {
                dispatch(commonAction.showCodePush(true))
            }, 500);
            break;
        case codePush.SyncStatus.UPDATE_INSTALLED:
            setStatus('Update Installed');
               codePush.restartApp();
            break;
        case codePush.SyncStatus.UNKNOWN_ERROR:
        default:
            setStatus('');
            setVisible(false);
            dispatch(commonAction.showCodePush(true))
    }
};

const codePushDownloadDidProgress = (progress) => {
    setDownloadProgress(progress)
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions