Is there a way for ThingSpeak using REST to send polling/notification data to Android Studio?
6 views (last 30 days)
I'm currently making an app in Android Studio (Java) that takes the JSON returned from api.thingspeak.com and presents it to the user. However, this system is connected to an Arduino sensor that sends data to the cloud, and I only need to take the latest one. I'm thinking of running the retrieval and parsing code through a loop, but that's computationally expensive and I want ot avoid that to the extent that I can. My main question is that, is there a way for me to set up my system in such a way that Thingspeak can send some sort of signal to Android Studio that it has received new data, and so I only need to run the Android Studio network connection code everytime something comes in?
Sutanu Maiti on 28 Jul 2022
REST calls are always polling based. You want server to push data to client. For that purpose, you must use MQTT.
REST is a representational state transfer architectural style designed as a request/response model that communicates over HTTP. MQTT is a publish/subscribe model that runs over TCP/IP sockets or WebSockets.
For more details please have a look at below: