basically i can't get my local or hosted mongo to connect to my app when running on meteor run android-device
. both local and hosted work fine with just meteor run
. i'm also unable to get this to run on the app published for testing to the play store but i assume once i'm able to run my hosted mongo locally i should be able to apply those fixes to the published version. i'm running ubuntu 18.04.
connecting to my local mongo when testing locally on my android phone:
so from what i’ve read online, the device and computer need to be on the same wifi network and i need to declare --mobile-server.
i’ve got my phone on airplane mode connected to the wifi network and plugged into my laptop for testing. i don’t believe this is a firewall issue because i have other hardware i’m connecting to this way for work.
these are the various scripts i’ve tried but none work. i’m at a complete loss! i’m running the latest meteor. anything in bold i’ve also tried on an emulator.
"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102"
<-- ip address of my laptop on my wifi network
"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102:3000"
"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:3000"
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:27017”
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1”
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:27017”
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:3000”
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109” <-- ip address of my phone on my wifi network
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109:3000”
“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server localhost:12816” <-- chrome’s remote debugging url
connecting to my hosted mongo (mongodb.com)
i do understand that the --mobile-server
here would be an online server that hosts your app, but this is where i get confused… if it’s hosted on the play store, what does this mean exactly? i have a personal website (domain registered on google, hosted on aws amplify) that i'm using a subdomain on for this purpose.
i’ve completed this guide https://sergelobatch.com/beginners-guide-to-deploying-a-meteor-app-to-an-aws-server-with-meteor-up/ and am able to access the app via the ec2 public ipv4 address and the subdomain through my web browser and it’s pulling data from the db as expected. i've allowed the public ipv4 of my ec2 access to my mongodb network. (sidenote, it's not https, does that matter?)
again running locally i’ve tried these, still with no luck:
“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:80”
“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:3000”
“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server http://<ec2_public_ipv4>:80”
^^^ i've tried all the above with also ROOT_URL=sub.domain.com
“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com”
“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com:80”
UPDATE:
i do see that i'm getting not found for some cordova assets. even after adding these packages manually these persist.
I20200624-01:28:29.236(-7)? 06-24 01:28:27.889 6311 6393 W MeteorWebApp: Asset /cordova_plugins.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle
I20200624-01:28:29.236(-7)? 06-24 01:28:27.914 6311 6401 W MeteorWebApp: Asset /plugins/cordova-plugin-splashscreen/www/splashscreen.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle
I20200624-01:28:29.236(-7)? 06-24 01:28:27.914 6311 6404 W MeteorWebApp: Asset /plugins/cordova-plugin-meteor-webapp/www/webapp_local_server.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle
I20200624-01:28:29.236(-7)? 06-24 01:28:27.915 6311 6393 W MeteorWebApp: Asset /plugins/cordova-plugin-statusbar/www/statusbar.js not found in bundle
mobile-config.js
App.info({
//
});
App.icons({
'android_mdpi': 'resources/icons/icon-48x48.png',
'android_hdpi': 'resources/icons/icon-72x72.png',
'android_xhdpi': 'resources/icons/icon-96x96.png',
'android_xxhdpi': 'resources/icons/icon-148x148.png',
'android_xxxhdpi': 'resources/icons/icon-192x192.png'
});
App.launchScreens({
// Android
'android_mdpi_portrait': 'resources/splash/splash-320x480.png',
'android_mdpi_landscape': 'resources/splash/splash-480x320.png',
'android_hdpi_portrait': 'resources/splash/splash-480x800.png',
'android_hdpi_landscape': 'resources/splash/splash-800x480.png',
'android_xhdpi_portrait': 'resources/splash/splash-720x1280.png',
'android_xhdpi_landscape': 'resources/splash/splash-1280x720.png'
});
App.accessRule("*");
App.accessRule("http://")
App.accessRule("https://")
App.accessRule("http://localhost:*")
App.accessRule("http://127.0.0.1:*")
App.accessRule("http://127.0.0.1")
App.accessRule('http://localhost:3000/*');
App.accessRule('http://192.168.1.109:3000/*');
App.accessRule('http://192.168.1.102:3000/*');
App.accessRule('http://<subdomain>.<domain>.com/*');
App.accessRule('http://localhost:3000/*');
App.accessRule('http://<ec2 public ipv4>/*');
App.accessRule('http://<ec2 public ipv4>:*');
for future reference: the fix was adding autoupdate and the necessary config via https://docs.meteor.com/packages/autoupdate.html and running dev with the flag --mobile server <ec2-public-ipv4>:80
and running build with --server <ec2-public-ipv4>:80