I am developing a news application. I dont want users to register in the application. When users download the application, data should be populated in the app from the server and any data added should be updated in the application.
How to update the data when any news has been added i.e how to identify users and send the data?
Your server don't need to track the new user. It is your app which will tell the server about the user. Write your data fetching code on the very first screen of your application (say Splash screen) and do check if there is any update on the server end
You can use the concept of fetching data on your Splash Screen, but if you dont want your user to get stuck you can use Intent Services to fetch your data in background, Once your data is received from server you can show it to the user.
How to use IntentService
Related
I am developing an app.
I have developed a spring server with MySQL.
And succeeded connecting the app to my server using Retrofit2.
I know how to send and get data using #GET and #POST.
But in my app, in an activity, a TextView should be changed automatically.
If a user clicks a button, let's say it's a button that purchases a lottery,
And then, the lottery's prize should be updated and everybody should see its changing.
Like, that TextView is connected to a single variable, a column of a row of a table.
I can do update that TextView when I restart the activity or click a refresh button.
But how can I update that automatically?
How can I change User A's view when User B purchases a lottery without doing anything?
Should I use firebase though I already have a spring boot - MySQL server?
or Room Database and send queries to MySQL server?
or is there any way that MySQL triggers an android's specific methods?
Can FCM (Firebase Cloud Message) trigger methods or activities not only send a push message?
Thank you for your advice.
Going with FCM seems a better approach to me.
The flow will be as follows:
Whenever any change happens in MYSQL write some triggers for it.
This Trigger can generate the FCM push notification and update the users which you need to update.
On the App side, receives the notification and retrieve the updated details.
Hope this will help you.
I need to fetch live data in Android App from a NodeJS/MongoDB API. For exemple, I have a list of tasks on the Android screen (fetched from the API). Then one of this documents (tasks) have changed in the MongoDB, the Android screen needs to update the data on the screen once this data have been changed on the server.
Can anyone help with some workflow? I am not looking for code. Ideias (Arquitecture/Libs) only.
Thanks in advance!
You can do this in two way.
Use silent push notification.
When data change in server then server send push notification
to app.
App receive notification Then app get call API to update Data.
Your app sends a request(s) to server periodically (After some
interval of time)
Reference link for same: link1, link2
I am working on an application which shows so many data to user, but problem is that it takes too much time to load data even we are using paging too. I want to know how facebook shows the data to user. are they storing the data in database first and then display it to user? if yes then how they maintain the user activity on that.
I'm developing an Android application , i have to develop an activity that contains a simple communications board .
The information that i want show are contained in a database , When the user started the activity the informations are downloaded , parsed and Showed to users.
Now i would implement a function That notify to the user When a new information is inserted in the db.
Now what that i don't understand is:
I need to implement a service that runs in background and polls the database and notify to the user when a information is inserted or can i use only the GMC (now FCM) ?
If i don't want use GCM there are another solution to do this ?
I have read some thread in stack overflow and there are different solution but i don't understand what is the best solution for my problem.
Speaking at a high-level, here's what I would do.
If I didn't want to use GCM then I would write my own service to make an http request to my backend web server to check if any new information is available. If any new info is received save it to my local Android database and refresh the app. I'd use Android's AlarmManager to start this service every so often (hourly, daily, whatever frequency I want).
in my Android app I have a ContactList downloaded from web. I need it in many parts of the app, so i download it at login. This call is paginated, so i need to call the method many times (depends of the contacts number), and I've seen that REST call in 3g connection are sequential.
Users from their app can edit their name, surname, email. So I have to reload the contact list not only to add new ones, but to update users information too.
The solution for this waste of time at login is to save my user array list into a file, at login open the file and use the old list and then, in background, dinamically download new fresh data and change every single user data with the new fresh one. Is this possible? how to do that?
you can use GCM for that which pushes updates to phone as soon as they happen on server. you can load the contacts at login, but as soon as something changes or created on server you can inform the user about it and can only load that Contact.
check link how to implement it
http://developer.android.com/google/gcm/index.html