I'm currently working on a simple mobile app with Meteor that aims to send user location data to a geospatial database or server. However, I'm facing some challenges and uncertainties about the feasibility of this task using Meteor. The issue arises when trying to get a token from the server through a POST request in the client-side code. Interestingly, the code works fine during testing (meteor run android-device) as I can successfully retrieve the token information. But, the problem occurs when attempting to build the Android phone app. Despite trying various methods such as AJAX POST, Meteor Http, and XMLHttpRequest, all of which work during testing, the token retrieval fails in the built app.
I've extensively researched Meteor and CORS documentation, as well as several forum posts addressing similar problems, but haven't found a definitive solution yet. This is somewhat new territory for me, so I'm unsure if there's something fundamental I might be overlooking or if my intended approach isn't supported by Meteor in a production environment without utilizing its server component.
Therefore, I have a few questions:
Is it possible to achieve what I'm aiming for in a Meteor phone app without involving the Meteor server component?
Could this issue be related to CORS and require specific handling that I might be missing, despite successful POST requests during testing?
Are there any specific steps to follow while building the Android/iOS app that could resolve this problem?
Or could the root cause lie elsewhere entirely?
I'm at a loss on what else to investigate or how to proceed with further troubleshooting.
Any assistance would be greatly appreciated!
Below are sanitized snippets of the code used for the successful POST requests during testing:
AJAX:
...
XMLHttpRequest:
...