I'm thinking about this for a while now. Well I have some ideas about this but I know it won't work. Now what I wanted to achieve is for the adapter for listView to be updated automatically while the webservice that gives a response in JSON format works on the background.
Okay to give more idea I just wonder how does the facebook app pulls the updates without using the pull to refresh? I'm thinking of 1 way: they use service which runs let's say every 15 seconds and get's the updates. But can this be done on a more real time way just like on how an AJAX works?
Hope someone can give an ideas on this cause I really wanted to create an app which runs on a realtime updates but doesn't require that much of a memory on the device end.
Use Google Cloud Messaging.
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android applications on Android devices, and upstream messages from the user's device back to the cloud. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a "new email" notification informing the application that it is out of sync with the back end), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device.
Here are the primary characteristics of Google Cloud Messaging (GCM):
It uses an existing connection for Google services. For pre-3.0 devices, this requires users to set up their Google account on their mobile devices. A Google account is not a requirement on devices running Android 4.0.4 or higher.
See this webpage for more details
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments