Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Expected elapsed time to see the changes on the app #44

Closed
frivera77 opened this issue Feb 26, 2016 · 9 comments
Closed

Expected elapsed time to see the changes on the app #44

frivera77 opened this issue Feb 26, 2016 · 9 comments

Comments

@frivera77
Copy link

Hi, i will describe the cycle applied:

  1. compile de app (cordova build android)
  2. copy the apk file and install the app on the device
  3. start the application and works.
  4. close the application (and forced to stop on android)
  5. some change on the index.html
  6. cordova-hcp.json configured with "update": "start".
  7. cordova-hcp build / deploy (changed file were displayed on the screen)
  8. start the application again, no changes showed. :(
@nikDemyankov
Copy link
Member

Hi,

"update": "start" means, that plugin will install the update, when application is launched. So, when you started the app on stage 8) - plugin loaded new update, but it didn't install it: he is waiting for the next app launch. Just restart the app again, and you should see the changes. If you want it to be installed immediately after the download - you should use "update": "now". Or you can control the update installation via JavaScript.

@frivera77
Copy link
Author

Hi nikDemyannkov, i just realized about this message from the CLI (rigth afer cordova run android)
"CHCP plugin after prepare hook:
config-file preference is not set."

is there any other config file besides .json / .ignore ?

in my www folder i have those files:
chcp.json
chcp.manifest

@nikDemyankov
Copy link
Member

Did you specify config-file url in your config.xml? As described in the documentation:

<chcp>
    <config-file url="https://5027caf9.ngrok.com/chcp.json"/>
</chcp>

@frivera77
Copy link
Author

I replaced the config-file value with the value from file .chcpenv

{
  "content_url": "https://5484e7e1.ngrok.com",
  "config_url": "https://5484e7e1.ngrok.com/chcp.json"
}

so my config.xml file looks like this:

 <content src="index.html" />
    <preference name="cordova-version" value="5.0.0" />
    <preference name="Orientation" value="portrait" />
    <chcp>
      <config-file url="https://5484e7e1.ngrok.com/chcp.json"/>
      <auto-download enabled="true" />
      <auto-install enabled="true"/>
    </chcp>

Getting the same message when running the android app

BTW, when navigatin to that address i'm receiving this error: Tunnel 5484e7e1.ngrok.com not found

Thanks for your help!

@frivera77
Copy link
Author

My bad, i was changing the incorrect config.xml :( sorry for the stupidity. Now I received the url config file when running the app, I did configure my update variable to now but... sad for me, not any change performed on the app. my files at the bucket are refreshed with no any problem, i did force close of the app, restarted and no luck. I'm about to give up.

@nikDemyankov
Copy link
Member

If you are running this on the Windows machine - open chcp.manifest file and check, that it has the correct paths for files. They should be relative to www folder and have / instead of \ in paths. There are some issues with the CLI client on Windows.

Also, I'm a bit lost here: to what server are you deploying your web code?

.chcpenv is created when you run cordova-hcp server command. It create's this configuration file, so when you re-run command - server's address would be the same. If you are using it for testing - then make sure, that it is running before launching the application. And that your config-file url is set to the right address in config.xml of the root project.

Let's say you have a cordova project with the following structure:

TestProject/
  config.xml
  hooks/
  node_modules/
  platforms/
  plugins/
  www/

If you run in console cordova-hcp server in the TestProject folder - you will see something like this:

Running server
Warning: .chcpignore does not exist. Using default ignore preferences.
Checking:  /TestProject/www
local_url http://localhost:31284
Build 2016.02.29-09.30.25 created in /TestProject/www
cordova-hcp local server available at: http://localhost:31284
cordova-hcp public server available at: https://211398d.ngrok.com

As a result, local server is now running on https://211398d.ngrok.com. To check this - open in the browser on your computer https://211398d.ngrok.com/chcp.json. You will see something like:

{
  "autogenerated": true,
  "release": "2016.02.29-09.30.25",
  "content_url": "https://211398d.ngrok.com",
  "update": "now"
}

If you are using local development add-on - you can skip the below and just launch the app from command line. That plugin will read .chcpenv data and set it to the config.xml. If not - then continue reading.

When your local server is up and running - you need to define config-file url preference in TestProject/config.xml like so:

<chcp>
  <config-file url="https://211398d.ngrok.com/chcp.json" />
</chcp>

Now run the app by executing cordova run. It should start, but there is nothing to update, since this is your first run. Open TestProject/www/index.html and change something in there. In the console window, where you started the server, you will see something like this:

File changed:  /TestProject/www/index.html
Build 2016.02.29-09.44.57 created in /TestProject/www
Should trigger reload for build: 2016.02.29-09.44.57

Then re-run the application - and it should update.

If you are running application on the real device - make sure, that it has access to your local server. Just open in the browser on your device https://211398d.ngrok.com/chcp.json.

If still no luck - open TestProject/platforms/android in Android Studio, launch the app from there and look into the logs.

If you are not using cordova-hcp server - absolutely same logic applies to any other server.

@simonsafhalter
Copy link

simonsafhalter commented Jun 10, 2016

Hi @nikDemyankov @frivera77 ,

Is this issue still open? I'm having the same problem. I'm running Ubuntu.
I did basically everything @frivera77 said (setting the config.xml, generated chcp.json, chcp.manifest, running cordova-hcp server), and after changing something in my app, I get the following messages on the local server:

Build 2016.06.10-17.40.37 created in /home/...
Should trigger reload for build: 2016.06.10-17.40.37

But nothing happens on my mobile device. Is there any way to get more logs from the local server?

EDIT:
I connected with adb shell logcat to my device and noticed when the server registers the change - I can see:

D/CHCP (11472): New Release is available

in the android logs. Then 1/10 times it updates the app with the logs:

D/CHCP (11472): Loading file: https://134caaae.ngrok.io/static/scripts/scripts.6a8aa2bd.js
D/CHCP (11472): Loader worker has finished
D/CHCP (11472): Update is ready for installation: 2016.06.10-17.55.09
D/CHCP (11472): Dispatching Before install event
D/CHCP (11472): Loader worker has finished
D/CHCP (11472): Update is ready for installation: 2016.06.10-17.55.09
D/CHCP (11472): Dispatching Before install event
D/CHCP (11472): Update is installed
D/CHCP (11472): Loading external page: ...

but usually it doesn't update and the last log I can see from CHCP is the 'New release available'

Thank you

@nikDemyankov
Copy link
Member

Hi @simonsafhalter ,

I think you should open a separate issue in https://github.com/nordnet/cordova-hot-code-push/issues, sine you are having problems with the plugin, not the CLI client. Please, do that :)

If possible, please give me a step-by-step guide on how to reproduce this, how you setup a project and use the plugin. Preferably for a new project.

On New Release is available event local-dev-addon should trigger fetchUpdate function of the main plugin from the JS side. Maybe it's not get called... But step-by-step guide should give me more info.

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-hot-code-push-cli anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #79 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants