cordova - MeteorJS Mobile build : rooturl is always 10.0.2.2:3000 instead of the real server specified during build script -


since few days have problem meteorjs , mobile build. problem occurs 3 differents apps.

i build application np scripting , kind of script :

#!/usr/bin/env bash  if [ -z "$npm_package_config_mongourl" ]; echo "no mongourl config found in package.json"; else echo "set mongourl" && export mongo_url=$npm_package_config_mongourl; fi if [ -z "$npm_package_config_mongooplogurl" ]; echo "no mongooplogurl config found in package.json"; else echo "set mongooplogurl" && export mongo_oplog_url=$npm_package_config_mongooplogurl; fi if [ -z "$npm_package_config_mailurl" ]; echo "no mailurl config found in package.json"; else echo "set mailurl" && export mail_url=$npm_package_config_mailurl; fi if [ -z "$npm_package_config_rooturl" ]; echo "no rooturl config found in package.json"; else echo "set rooturl" && export root_url=$npm_package_config_rooturl; fi if [ -z "$npm_package_config_packagedirs" ]; echo "no packagedirs config found in package.json"; else echo "set packagedirs" && export package_dirs=$npm_package_config_packagedirs; fi if [ -z "$npm_package_config_mobileserver" ]; echo "no mobile server config found in package.json (mobile app offline)" && export rebolon_mobile_server=""; else echo "set mobile server" && export rebolon_mobile_server=" --server=$npm_package_config_mobileserver"; fi if [ -z "$npm_package_config_settingsfile" ]; echo "no settings file found in package.json" && export rebolon_settings=""; else echo "set settings" && export rebolon_settings="--mobile-settings $npm_package_config_settingsfile"; fi  if [ -z "$npm_package_config_buildfolder" ]; (     echo "set build folder before running build system!"     exit 1 ); fi  meteor build $npm_package_config_buildfolder $rebolon_settings $rebolon_mobile_server $*; 

so once env vars created meteor binary call looks :

meteor build ../../build/mobile --mobile-settings ./settings.json --server=http://myserver:3000 

then inject app android emulator , open chrom remote debugger. run app inside emulator , have strange behaviour :

  • first app seems run , connect server
  • few seconds after looks llike app refreshing , connected http://10.0.2.2:3000 instead of original server uri

if @ debugger can see global var meteor_runtime_config.root_url not 1 set during build command :

 {meteorrelease: "meteor@1.2.1", public_settings: object, root_url: "http://10.0.2.2:3000", root_url_path_prefix: "", appid: "1rm26uv1lh7ui31i489b2"…} 

the problem happens app, not after few seconds after startup. in app occurs when use camera throught app , when select photo come app, root_url become http://10.0.2.2:3000

and third app, problem occurs when exit app (or switch smartphone home per exemple) , come app. refresh, , root_url 10.0.2.2:3000.

i don't have clue understand this. help.

ok, understood errors : meteorjs full platform, , 1 app can used build cordova app, web site, , server. when build app has android platform, have specify --server parameter full uri of server used ddp , cache application (--server=http://youserverip:port) when run server, must not forget specify mobile-server params because used configure cordova app when new version of application served smartphone (--mobile-server http://yourserverip:port)

take care @ 1 thing : * build there sign "=" --server=http://youserverip:port * whereas when run server there no sign --mobile-server http://yourserver:port

in case build good, explain why @ first run of app had connection server server misconfigured because never pass mobile-server params. when server send new version, didn't send server uri cordova app consider client application. , when app refreshed, connectes it-self.

i have modified boilerpate fix start.sh scripts


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -