Can someone please post a list of the steps that have to be done to connect android app (made with the meteor build tool) with the server (not local).
Till now i developed the app on the server (Ubuntu) and build the .apk there also. I assume there is some configuration that have be to done like in the settings-mobile.json file and perhaps adding some server info as parameters in the build command. But i really cant find any “straight-forward” explanation in the web.
did u find informations about that ? im at the same point and i can’t really find good infos on the web, there is not too much about that in the meteor doc.
When you compile the mobile app you have to set --server
When you call --run-android it takes care of it for you - but for builds, you have to specify it at compile time. You can even specify the IP address of your local machine for testing (e.g http://192.168.0.2:3000)
I would love to know if there is a way to change the server on the fly on the client, @sashko is that possible?
1) Add the mobile platforms (e.g. android) to the app that you want to build for: meteor add-platform android
2) Create the bundle with this command: meteor build ../bundle --server "SERVER-ADDRESS":"PORT"
e.g. meteor build ../bundle --server 5.189.163.221:3301
So now the app contains the server information to which it will connect.
You can take the .apk file that was created with the build command (somewhere in the bundle folder), and install it on android device or emulator (BlueStack is a good one for windows)
When the app will start i think it will show you a message that connection with the server failed
or something like this.
Now for the Server Side ->
Unfortunately i didn’t make the app to the production phase
So i didn’t ran the bundle file on the server.
It was in the “raw” meteor format.
3) So to make the Server to listen for the Mobile apps i used this commands: MONGO_URL=mongodb://127.0.0.1:27017/"dbname" meteor --mobile-server "SERVER-ADDRESS":"PORT" --port "PORT"
e.g. MONGO_URL=mongodb://127.0.0.1:27017/meteor meteor --mobile-server 5.189.163.221:3301 --port 3301
P.S.
I assume that if you build the app with the following command, perhaps the bundle file on the server also will work. Never tried it though.
I let the port by default here and i added the server info (user and password) info in my mup.js file, i didn’t have to specify for my database assuming mup uses the same than connecting to the server so here what i have :
Also i notice this time that my build command made two apk’s one in the /bundle folder that i specified in my first command and one other in .meteor/local/cordova-build/platforms/android/build/outputs/apk !
Why two apks ? im wondering…
Anyway thank u for ur help and i will add more infos as soon i found some…