Skip to content

Android: Update not pushing to production #37

@razorsyntax

Description

@razorsyntax

The code is live in the play store.

What's odd is that if I install the same apk to the emulator on the local dev environment that also gets pushed live, the emulator gets the updates and the devices with the same code from the play store do not.

I feel like I'm missing something somewhere but I'm not sure of the issue.

I thought maybe my versioning scheme for android:versionName could be the issue so I changed it from 9 to 9.0 as you can see in the manifest below.

The deployment history shows that the code is being pushed somewhere but no active installs.

Android Manifest:

<manifest
        android:versionCode="18" 
        android:versionName="9.0"
...

main.ts

import { platformNativeScriptDynamic } from 'nativescript-angular/platform';
import { AppModule } from './app.module';
import * as application from 'tns-core-modules/application';
import { AppSyncService } from './services/app-sync.service';

const appSyncService: AppSyncService = new AppSyncService;

platformNativeScriptDynamic().bootstrapModule(AppModule);

application.on(application.resumeEvent, () => {
    // Check for updates when the app is loaded or resumed
    appSyncService.syncWithAppSyncServer();
});

Custom App Sync Service

export class AppSyncService {

    private static APPSYNC_IOS_PRODUCTION_KEY = 'production_key_ios';

    private static APPSYNC_ANDROID_PRODUCTION_KEY = 'production_key_android';

    syncOptions = {
        deploymentKey: isIOS ? AppSyncService.APPSYNC_IOS_PRODUCTION_KEY : AppSyncService.APPSYNC_ANDROID_PRODUCTION_KEY,
        installMode: InstallMode.ON_NEXT_RESTART, // default InstallMode.ON_NEXT_RESTART
        mandatoryInstallMode: isIOS ? InstallMode.ON_NEXT_RESUME : InstallMode.IMMEDIATE, // default InstallMode.ON_NEXT_RESUME
        updateDialog: { // only used for InstallMode.IMMEDIATE
            optionalUpdateMessage: localize('@@AppSync_OptionalUpdateMessage'),
            updateTitle: localize('@@AppSync_UpdateTitle'),
            mandatoryUpdateMessage: localize('@@AppSync_MandatoryUpdateMessage'),
            optionalIgnoreButtonLabel: localize('@@AppSync_OptionalIgnoreButtonLabel'),
            mandatoryContinueButtonLabel: isIOS ? localize('@@AppSync_MandatoryContinueButtonLabel_iOS') : localize('@@AppSync_MandatoryContinueButtonLabel_Android'),
            appendReleaseDescription: true // appends the description you (optionally) provided when releasing a new version to AppSync
        }
    }

    constructor() { }

    syncWithAppSyncServer(): void {
        console.log("Querying AppSync...");
        AppSync.sync(this.syncOptions, (syncStatus: SyncStatus): void => {
            if (syncStatus === SyncStatus.UP_TO_DATE) {
                console.log("AppSync: up to date.");
            } else if (syncStatus === SyncStatus.UPDATE_INSTALLED) {
                console.log("AppSync: update installed.");
            }
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions