Ionic Deploy "auto" behaves the same as "background" on Android

I have installed and configured the Ionic Pro deploy plugin and originally configured it to “background” but I had to start the app twice to get the newly deployed versions of my app. So I changed the update_method to “auto” which is supposed to download new deploys during the splashscreen and then start. Problem is that “auto” behaves just like “background”. So the first time a user installs my app, they get the base version of the app. They have to restart the app a second time to get the latest Production build running.

Here’s the relevant portion of my Config.xml:

<plugin name="cordova-plugin-ionic" spec="^2.0.4">
        <variable name="APP_ID" value="xxxxxxx" />
        <variable name="CHANNEL_NAME" value="Production" />
        <variable name="UPDATE_METHOD" value="auto" />
        <variable name="UPDATE_API" value="" />
        <variable name="MAX_STORE" value="2" />

Has anyone else had trouble with update_method=“auto” behaving the same as “background”?

UPDATE 1: This only seems to happen on Android. The published iOS version does the update during the splashscreen (with a quick flash of white) and applies the latest deploy. Working on the android version to do a manual checkAndApply once the app is started.

I gave up on deploy for android. IMHO it doesn’t feel production ready. Every so often on android, it would fail to download the zip file and the app would just freeze up on the splashscreen.

That’s exactly the behavior I’m getting at the moment. Were you getting this problem with UPDATE_METHOD = “auto”?

Mine broke set to auto

I got it to work but not the way it’s supposed to. Basically, I just wait a while before checking. I let my login screen reach it’s ionViewDidLoad and then I start a 3s timer which then runs checkAndApply. Now it works but it looks “glitchy” since it will reach the first view, then flash to white and restart.

So it’s a question of timing. There’s an operation that needs to finish before we can run checkAndApply so I’ll keep playing with it for a bit but I agree with you, the current deploy plugin with “auto” does not currently work as intended on Android. Hopefully, the Ionic team will come up with a new version and my timed manual check will never have to kick in. The important part is that there’s a work around for the time being.

I did wonder if it was because the app is not ready yet…

There’s a few other things that make me think the app isn’t ready when it ‘should’ be.

Have you ever had issues where loading something (e.g a refresh/access token) within app.component fails randomly in constructor, ngOnInit and some other ‘ready’ functions?

quick example where sometimes on app cold boot, this returns null/undefined:

storage.ready().then(() => {
  //load access token and run refresh'refresh_token')
  .catch(e => {
     //token not found, go to login page
     this.rootPage = LoginPage;

What’s odd with this, is that if you reload the app without doing anything else, it then works, finding something in storage as expected. I’ve tried wrapping within platform.ready and storage.ready, but still getting the odd random ‘undefined

Hmmm… my init function does:

await this.platform.ready();
let user = await"user");

Never fails on my side.
I’m currently playing with various events to see when checkAndApply is safe to run.

1 Like

I have a new theory! When I run it in debug mode, I can see my code running while the splashscreen is still up (even though my code runs after splashScreen.hide(). From what I understand about update_method=auto is that it checks for updates during the splashscreen so maybe there’s a conflict. Currently I was doing tests by running the checkAndApply after a 250ms timer. It works while there is no update found but fails when I deploy a new version (stays stuck on splashscreen). I’ll try moving the checkAndApply back to the ionViewDidLoad. Basically, I need to make sure the splashscreen has closed. Someone might ask “Why use update_method=auto” and do the check manually?". The reason is that “auto” currently works as expected in iOS and I want to keep that. For android, I need to double-check… but I don’t know how to check if the splash screen has closed… or what the state of the Pro.deploy component is.

Thanks, i’ll try using this way, the project was started quite some time ago and has lots of deeply nested promise chains with chances for error

How can we know if the Ionic team are aware of this bug? Is there a way to flag this as a bug in the Ionic Framework?

I GOT IT! :smile: (At least I think I got it, still testing but looking good!)

It’s a plugin version problem. As you might notice from my original post, I was using cordova-plugin-ionic 2.0.4. I thought about the fact that all of this is happening during the splashscreen (plugin) so I checked my plugin version for the cordova-plugin-ionic and the latest is up to 4.1.3 (slight gap since January!). Tried to install it and it said it required cordova-plugin-splashscreen 5.0.0 (I was still on 4.x.x). So I removed the splashscreen and installed 5.0.2, then installed the latest cordova-plugin-ionic (4.1.3) and now it seems to work on Android with update_method=“auto”.

Please try it on your side and let me know if it works for you. I can then confirm that this is the solution.

So this was my mistake but it drives me mad that we constantly have to check for new plugins. When I wake up in the morning, I check my phone notifications, make coffee, shower and eat. Need to add an extra step to my morning routine. Check for new plugins and dependencies! :wink:

STRONG recommendation: go install “cordova-check-plugins” at and then run “cordova-check-plugins --unconstrain-versions”.

It will show you the list of your installed plugins and the latest version that’s out there. Very useful! :slight_smile:

1 Like