locked
Continuous data polling RRS feed

  • Question

  • User232880 posted

    Hello,

    I need to work on an app where data needs to be pulled from a cloud based "MySQL" database.

    The app may pull data on a regular interval, say 5 seconds. The app may show an alert or vibrate the phone based on the certain status of data . This app needs log in. So the data retrieval is filtered by the logged in user's id. I think the analogy is very similar to an email app, where the user is notificed via vibrator or alert for a new email.

    It looks like that this app may need to implement some sort of infinite backgrounding. However, there is no infinite backgrounding service available (only finite bacgrounding available). I am stuck here and don't know what could be the best practice or design to resolve this problem. I think that I don't have any option to recommend push notification here because I don't have any control on the database updates made on the cloud. Therefore, I cannot introduce some sort of triggers whenever database updates are made. My best bet would be to keep polling the database and keep checking it on the client side. The DBA has allowed me to add a field on the datatables. That boolean filed could work as a flag to verify whether the record has been looked into or not. So based on that app keeps looking for the records where the field value is false. If rthe ecords are available, then it would vibrate or show an alert.

    I really appreciate any advice here. I am looking for an advice on how to poll the remote database frequently. I afraid that doing frequent polling may consume lots of resources and data. This may result into app rejection by the store too. Please let me know whether my fear is correct. Is there any alternative available?

    Friday, June 10, 2016 6:21 PM

All replies

  • User2148 posted

    are you working with PCL or you want a Native solution?

    Friday, June 10, 2016 8:52 PM
  • User232880 posted

    I have not started working with this app yet. I am still considering my options. I would like to go with PCL if I could do it without much trouble. The UI should be simple. I like to go with Xamarin Forms. I like to achieve maximum code reuse.

    Friday, June 10, 2016 10:24 PM
  • User2148 posted

    I use this to polling a gps. I think you can do the same https://github.com/acaliaro/TestThread

    Friday, June 10, 2016 11:15 PM
  • User60257 posted

    That's a bad idea - as you say it's going to eat a lot of data (and battery) which will annoy users. Certainly Apple will reject you if you do this as you would have to use a hack to get round your app being killed. Android would let you do it but you will kill the users data so you need to be smart and only do it on wifi or similar.

    Honestly, push is the right way. You could always write something that sits on Azure/AWS or similar and polls the database, then sends a push if the data is updated.

    Saturday, June 11, 2016 10:47 PM
  • User232880 posted

    Thanks much everyone for your help and suggestions. @JimBennett idea looks decent. This way I will be still using push notifications provided the constraints I am dealing with. @AlessandroCaliaro thank you for your sample project. That would be helping me in the sense that I have not had many opportunities to work with GPS. So the sample can teach me a lot.

    Sunday, June 12, 2016 3:57 PM