Real time update on Android apps

Asked

Viewed 680 times

6

Looking at the API from instagram and doing searches on the internet I came across a big question, how they do synchronization of data in Real Time without having to save "photos and videos" in sqlite?

The documentation of Instagram says our app can be notified every photo update.

But it is possible to develop something similar without using the API theirs?

I could use a Observer that every modification triggers a synchronization with my server?

My intention is to create something similar where I have a real time update.

  • 1

    Now here’s an excellent question.

2 answers

3


I believe you’re looking for the model of push notifications to receive in your app notifications about what happens in real time in your app or web service and then download more information as needed.

On Android is possible to use one of the many services available:

Another alternative is to create your own push Notifications architecture, one of the most complicated parts is to optimize the server information pooling system so that it does not exhaust the cell’s resources (battery, memory, data etc)and once received the update notification synchronize the background details with a Service.

  • That one push notifications works as an Observer? notifies a listener? and performs the "transaction" ?

  • Yes, and you decide what to do with the notification, for example, alert the user, send a notification, run a method...

  • @Wellingtonavelino had already heard of Google Cloud Message, I think it is even the most used.

  • 2

    Google cloud message perfectly meets my demand

1

You can work with the Services concept, which executes requests to the server to check from time to time if there is something new and update your application or send a notification to the user.

Or work with Apis like Google Cloud Message, among others that can facilitate your requests and notifications through Push.

Advantages / Disadvantages:

Services - You will have to set it manually, the time being started, time, etc.

Push Notifications - You don’t have to worry about when to start and when to end, because it will always be "asleep", it will only "wake up" when there is something new on the server.

I hope I’ve helped!

  • That one push notifications , works as a notifier only?

  • No, it can also run some method of your choice in Background.

  • 1

    Complementing my answer, if you choose to work with Services you should keep in mind that it can consume more battery depending on your use, for example if you want it to always notify when there is something new, you should "start it" and leaves it open even when the application is closed, so this service will always run without the user being able to see.

  • very good, I’ll take a look at it tonight.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.