Search code examples
androidcordovameteorbuildproduction

How do I build my meteor cordova app for my remote server instead of local host?


I have an app I intend to make into a Cordova app and a website as well. I have already put the files onto a server and I can navigate to the website, it works.

However, the problem comes when I try to run the same app on my device as a Cordova app pointing to my remote website instead of localhost, OR build an apk file pointing to my remote server instead of localhost

I have my App ready with the android platform.

when I do this. meteor run android-device --mobile-server=https://my-remote-domain.com/ It's blank

but when I just say meteor run android-device

it works because it's using my localhost

How do Successfully build an apk file or run on my android with my remote server instead of Localhost. I want to be able to update my files and push them to my remote server, and when that server updates, my app updates too.


Solution

  • This appears to be a Meteor bug. The first step is to do as you are doing, run Meteor locally with --mobile-server set:

    meteor run android-device  --mobile-server=https://my-remote-domain.com/
    

    The next step is to do a build with --server

    meteor build --server https://my-remote-domain.com/ ../v0.0.1
    

    The resulting APK, found in

    ../v0.0.1/android/project/build/outputs/apk/android-armv7-debug.apk
    

    Will refer to your domain correctly. This apk file, thanks to the hot code push mechanism, should last you a while, because it only needs to be regenerated if you change your Cordova plugins.