cordova-plugin-meteor-webapp
cordova-plugin-meteor-webapp copied to clipboard
HCP for android emulator
I made this change to get HCP to work in the android emulator. I think it's safe, given that it doesn't do anything unless this is android and "localhost" is present in the ROOT_URL string, which means it has to be the emulator -- right? The idea was taken straight from code that runs elsewhere that deals with the 10.0.2.2 android issue.
This travis build is failing for a reason unrelated to the change. The change is in Android-only java code, but the build is failing because it can't find the iPhone 11 Pro Max.
Hello @RealHandy, we both took the same path to solve this problem. And as I haven't seen your PR before I end up opening the #93 issue to address this. In the end, I came to the conclusion that we don't have a real bug in Meteor but a lack of clearer documentation that points to --mobile-server
as a mandatory parameter for HCP to work on android.
Additionally our .replace()
solution has a problem, it doesn't work if real devices are being used to debug the app because 10.0.2.2
is a standard that points to the emulator's host machine (details). So to make it work on both emulator and real devices you should run your meteor app with meteor run android --mobile-server 10.0.2.2:3000
or meteor run android --mobile-server 192.168.1.4:3000
as I pointed in my last #93 comment.
That's why I believe this PR shouldn't be merged, but I encourage anyone to submit a PR to meteor docs and add this caveat. I might do this in the future but feel free to do it first.
Hello @RealHandy, we both took the same path to solve this problem. And as I haven't seen your PR before I end up opening the #93 issue to address this. In the end, I came to the conclusion that we don't have a real bug in Meteor but a lack of clearer documentation that points to
--mobile-server
as a mandatory parameter for HCP to work on android.Additionally our
.replace()
solution has a problem, it doesn't work if real devices are being used to debug the app because10.0.2.2
is a standard that points to the emulator's host machine (details). So to make it work on both emulator and real devices you should run your meteor app withmeteor run android --mobile-server 10.0.2.2:3000
ormeteor run android --mobile-server 192.168.1.4:3000
as I pointed in my last #93 comment.That's why I believe this PR shouldn't be merged, but I encourage anyone to submit a PR to meteor docs and add this caveat. I might do this in the future but feel free to do it first.
I'm not sure we're addressing the same issue. This PR is only to deal with debugging in emulator, because when debugging in emulator "localhost" means the machine running the emulator, not the emulator itself, so to debug the emulator, you have to declare 10.0.2.2 instead. You probably know all that. But this doesn't come into play at all when using a real device. It's strictly to debug on an emulator. It sounds like your issue has also to do with real devices in some way, which on the surface, sounds outside the bounds of this change. Maybe?