I hope what I want to do here is possible. I have an app that sends GPS coordinates to a Javascript web app and I need to allow the web app user to stop the Android app from sending coordinates by clicking a button in the web app. I am not using a WebView for the Android app and at this point, it’s not really an option because of time.
Is there a way that I can create a listener in the Android app that listens to function calls by the Javascript web app?
I’m not exactly sure what you mean by “sending GPS coordinates to a javascript web app”, but since you aren’t sending GPS coordinates to a client, I assume you’re sending them to the server.
If you are constantly sending these coordinates to the server then you can simply have that button update a boolean on the server-side. Every time the Android app gives coordinates, the server can check this boolean, and tell the Android app to stop sending coordinates if necessary.
That doesn’t handle toggling back on of course, but you don’t mention that.
As for listening to calls by the web-app, you might want to look into server-side push / Comet / long polling.