-3

Apps like Facebook,whatsapp,any other news app *get the things updated * like the status,newsfeed,chats how it works and is there any tutorial for doing stuff like this(Newsfeed,chat,etc)

2 Answers2

0

Regular way is to reconnecting to server after specific time. For example use Handler to get new updates from server every 30 seconds. Look at below code:

final Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    while (true) {
                        getUpdates();
                        handler.postDelayed(this, 30000);
                    }
                }
            }, 30000);
0

second way to handle this is a push notification from server.

hint: search for "gcm" and have look to this link about its limitations link

Community
  • 1
  • 1
LuXoR
  • 53
  • 6