Live updates simply not appearing on device

I’m evaluating appflow as it’d be very useful for our project and would be keen to get one of the paid plans.

However, I don’t seem to be able to get the basic live deployments working with my Ionic/Angular/Capacitor app, and I’m a bit at a loss as to how to troubleshoot.

I have followed the docs and installed the SDK in my app.
I can see the app id, channel name (Production) and update method (auto) in string.xml and info.plist.

I have successfully built the app in appflow (web build), and I can see on the deployments screen my build assigned to the production channel of type ‘Live Update’.

I’m not seeing changes on device after the splash screen, so I’ve put together a screen using the ‘Deploy’ plugin to show me what version is installed, and if updates are available.

import { Deploy } from 'cordova-plugin-ionic/dist/ngx';

...

private async loadDeployInfo() 
{
    const info = await this.deploy.getCurrentVersion();

    if (info) {
      this.liveUpdateId = info.buildId;
    }    

    const updateCheck = await this.deploy.checkForUpdate();

    console.log(updateCheck);

    if (updateCheck.available) {
      this.updateAvailable = updateCheck.build;
    }    
  }

I call the above ‘loadDeployInfo()’ when my view loads and display out the build Id and whether an update is available. Neither show up anything when testing on device. I’m using capacitor, so running locally involves running ngx cap commands and opening android studio, which is not a tool I know how to get debug information out of, but I’m not seeing any red in the console as it’s running.

I’m a bit stuck. I’m keen to use app flow, but I’m not seeing basic live updates take effect and there’s not much documentation on troubleshooting.

I’ve tried to get some more in depth information using chrome://inspect to see what’s in the console on the device.

I can see this, I imagine this can have an impact on whether the live update stuff will work:

deviceready has not fired after 5 seconds.
capacitor-runtime.js:2181 Channel not fired: onIonicProReady
vendor.js:95897 Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
(anonymous) @ vendor.js:95897

I also see this error:

Resources$NotFoundException: String resource ID #0x0

Then I stumbled across this post:

If I add this to strings.xml it seems to fix the error above, I will test if this means my updates are applying…

  <string name="ionic_max_versions" >2</string>
  <string name="ionic_update_api">https://api.ionicjs.com</string>
  <string name="ionic_min_background_duration">30</string>

(Why doesn’t ‘ionic deploy add’ do this if this is essential?)

I’m yet to test on ios, wouldn’t be surprised if that needs similar tweaking.

1 Like

Ok, things are working well on android, I can get live updates on command using the API.

Unfortunately, the same can’t be said for iOS, it’s not detecting the updates. Running in xCode I can see one error in the console:

“sourceURL”:“user-script:55”} [error] - ERROR Error: Uncaught (in promise): SyntaxError: the string did not match the expected pattern.

I’ll now go hunting to see if anyone else has solved this.

REALLY frustrating that Appflow is this buggy and difficult to configure and troubleshoot.

2 Likes

Ok, I’ve found a similar fix for iOS editing info.plist. I’ve changed these values where there seems to be some kind of variable substitution that is supposed to happen some where:

<key>IonApi</key>
<string>$UPDATE_API</string>
<key>IonMaxVersions</key>
<string>$MAX_STORE</string>
<key>IonMinBackgroundDuration</key>
<string>$MIN_BACKGROUND_DURATION</string>

To hard coded values:

<key>IonApi</key>
<string>https://api.ionicjs.com</string>
<key>IonMaxVersions</key>
<string>2</string>
<key>IonMinBackgroundDuration</key>
<string>30</string>

It seems there is just some gap in what ‘ionic deploy add’ is doing missing out this configuration.

Ionic have update the CLI with my feedback, hopefully this will help others in future:

2 Likes