I am building an app in android studio that gets data from my application in the The Things Network. The Android app should be able to display the data. It is an IoT project. I have data in TTN, android app is being built, now, my challenge is to sync that data in the app i am building. Do i need a code to do that in Android studio, or i use a solution by a third party and connect it to Android Studio?
Any suggestions on how i get the data from TTN and display in app say in real time?? Any help would be appreciated. Thank you guys.
If you only want real-time you can use MQTT subscription. If you need to get all data you’ll need to look at another option like the data integration. May-be combine them (make sure to deduplicate somehow).
Fetching as JSON from Data Storage won’t be totally real time as you’ll have to poll, but would make for a simple implementation.
Thanks for the reply, what if i do not really care about real time data. Your reply would be appreciated.
Any notes or link as to how i can go about it?? Thanks your reply would be much appreciated.
Note that the Data Storage integration only stores 7 days of data, and
sends does not send CORS headers (implying that you cannot access it from a regular browser, but fetching from an app should probably work).
Thanks Arjan. Do you think or suggest AWS IoT integration could help me get the data(TTN) that is pushed to AWS, then from AWS i sync the data to my andriod application? What are you thoughts on this also. Thanks man.
Under no circumstances should anyone pull the whole 7 days in one go unless they are seeding their database - they should get the last uplink timestamp, do some simple maths and request everything since then. And they should proxy it in to a database of their own.
I personally use the HTTP integration in to a mySQL database that I have my own API calls setup for - so it can all run on a small virtual server that is running the bare minimum and no MQTT Client to mange.
But I also have a multiuser desktop app where the server gets the updates from Storage (as it was simpler at the time to code the JSON requests to Storage Server as we hadn’t got as far as a rational API on our HTTP integration), and that only gets the uplinks since the last one.
Requesting only the uplinks since your last poll is desperately simple to add, I’d be quite happy for TTN to rate limit a 7d request to once every 48 hours to slow down those that can’t be bothered.
So, for @Jonathan_M, I’d highly recommend using the HTTP Integration to your own internet server that stores the data as you need it for your application and create a simple API for your app to make requests. I’d also store the data on device and only request the new uplinks to minimise network / data use on the app.