SOLVED: Mobile + Desktop Hot Code Push = Simply Doesn't Work

#1

Alright, some times it works reliably, some times it doesn’t.

I have a published Android App, and it doesn’t pick up HTML, JS, IMG changes all the time.

However, I recently updated the server, and thankfully, my Android app did pick up the changes. So I don’t think it’s a problem on the Mobile client, but something on the web server that’s not passing the information to force updates on clients.

When Googling this, there’s lots of questions and no answer.

So, how does the HTP technology work? Is there a variable I can set that FORCES an HCP to take place? I’d be totally fine with that.

Web: www.StarCommanderOnline.com

Android: https://play.google.com/store/apps/details?id=com.starcommanderonline.anormore

SOLUTION: https://github.com/meteor/meteor/issues/7030

1 Like
#2

Getting some where now!

In a nutshell, Meteor lists assets for clients to compare to the server

This is done with a hash, which can be found here:

So it would appear that something I’m doing in each update is changing this hash. So before updating the next mobile apps and stuff, I have to ensure this hash doesn’t change. I’m not changing ANY packages, but some how, this hash must be changed. I wonder if I can force it…

#3

NICE. You can totally over ride this. So if this infact a known Meteor bug, this is the work around!


You may want to override the compatibility version if you want hot code push to reach older apps that don’t have the latest version of your native code from the app store. Let’s say you’re developing an iOS app, you have the plugin cordova-plugin-camera@2.4.0, and your app has the compatibility version pictured above, 3ed5b9318b2916b595f7721759ead4d708dfbd46. If you were to update to version 2.4.1 of cordova-plugin-camera, your server would generate a new compatibility version and your users’ apps would stop receiving hot code pushes. However, you can tell your server to use the old compatilibity version:

METEOR_CORDOVA_COMPAT_VERSION_IOS=3ed5b9318b2916b595f7721759ead4d708dfbd46 meteor run ios-device

or

METEOR_CORDOVA_COMPAT_VERSION_IOS=3ed5b9318b2916b595f7721759ead4d708dfbd46 meteor build …/build --server=127.0.0.1:3000

1 Like
#4

Here’s the discussion on GitHub that resolves the issue:

this is now available in 1.4.4.2 with METEOR_CORDOVA_COMPAT_VERSION_IOS, and METEOR_CORDOVA_COMPAT_VERSION_ANDROID env vars. Can this be closed?

#5

How should one use METEOR_CORDOVA_COMPAT_VERSION_IOS and METEOR_CORDOVA_COMPAT_VERSION_ANDROID in combination with Meteor up?

Is it enough to build an .apk and use these variables in the build command?

I suppose the two environmental variables also need to be bundled in the server upload, since they are accessible at Meteor.AbsoluteUrl("/__cordova/manifest.json"). Are both necessary?

#6

Yes both are explicitly necessary, as described by the official Meteor docs.

Again - make sure your web, ios, android and desktop apps are built on the SAME computer.

Specifically regarding your question, it should be enough to declare these variables in the build command. I have mine set to globals, and am not messing with it for the next while - but it should work, yep!

1 Like
#7

Damnit, I’m back to the drawing board.

My Android app just updated no problem, but my iOS app isn’t fetching the update.

FML this is stupid! Grr.

#8

My problem is also not solved yet.

I cannot force the variables in the cordova manifest file. https://myroutes.io/__cordova/manifest.json

How is it possible to set METEOR_CORDOVA_COMPAT_VERSION_IOS & METEOR_CORDOVA_COMPAT_VERSION_ANDROID with Meteor Up?

#9

You’re doing it wrong.

Are you on Windows, Linux, or Mac?

You must properly set the environment variables…

NOTE: I like to do on Windows %%METEOR_CORDOVA_COMPAT_VERSION_IOS%% in a command prompt, that should spit out your version. If it does, good. If not, you’re still not even close to correctly setting up your enviro variables.

Mac and Linux were pretty weirdo to set them up. Keep digging.

It DOES work.

1 Like
#10

Did you figure out how to set these vars with mup?

#11

I thought it was supposed to work like this, but unfortunately I do not see the variables in the manifest.json

Meteor.startup(function() {
  process.env.METEOR_CORDOVA_COMPAT_VERSION_IOS = "ac6721a8b67b5a2221afacfd1e9adc3290b77b94";
  process.env.METEOR_CORDOVA_COMPAT_VERSION_ANDROID = "ee9764f3b029054a29299cf9e8a96332402ca404";
});
#12

I think these need to be set before metor build.
I am not sure how to get ENV vars to be honored when mup spawns the build.

#13

I’m asking now on https://gitter.im/meteor-up/Lobby

#14

You won’t have any luck doing this, you have to set BEFORE the build. I know the documentation says this work, but it doesn’t.

YOU NEED TO SET SYSTEM ENVIRONMENT VARIABLES.

So on windows you can do: cmd.exe

echo %%METEOR_CORDOVA_COMPAT_VERSION_IOS%%

And that should spit out your version setting. If it doesn’t, you did it wrong.

1 Like
#15

how does this work on mac osx?

#16

Setting the env vars on the machine, worked for me. You should be able to set it up depending on your shell tcsh or bash:

(bash)

export METEOR_***_IOS=907097097297hh87ggoh
export METER_***_ANDROID=723096906064goigj
mup deploy

(tcsh)

setenv METEOR_**IOS 8702604ggdgfg ..
mup deploy

( under buildOptions in mup.js, I also explicitly added server: ‘actual root_url’)

#17

Google is your friend here. It’s super weird. But mines working on Mac. Follow google.

#18

Well I’m back to Googling this 2 years later… cannot believe Meteor still hasn’t addressed this. What a waste of time.

But it makes me feel like I’m pioneering stuff LOL… Let’s see if I can read my old notes.

1 Like