Getting Updates From Parse.com
I am trying top use parse.com for an app but I need the information in the phone to update when something changes in the server. is there a way to do continuous checks or for the s
Solution 1:
IFAIK, you can implement it by using ScheduledExecutorService.
By using ScheduledExecutorService, you can get update from server every X second(s).
Here is an example,
ScheduledExecutorService scheduleTaskExecutor = Executors.newScheduledThreadPool(5);
scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
publicvoidrun() {
//Codes that check update from server
}
}, 0, 1, TimeUnit.MINUTES);
This will check update from server every 1 minute.
To stop checking update,
scheduleTaskExecutor.shutdown();
Hope this helps :)
Solution 2:
Another possible solution could be to use push notifications to notify the app that there has been a change on the server, and trigger a pull to update everything in the app. It really depends a lot on what kind of data you are dealing with, how often it is going to update, and how quickly the user need to know that there has been a change.
Post a Comment for "Getting Updates From Parse.com"