I'm working with a chat app in Java that uses an MVC Client-Server model. For the conversations screen, I currently have an "Update" button that refreshes the chat every time, so if someone i'm talking to posted a message it won't be displayed until after i hit "update"
Wondering if there's another way to do that? I know of the blinker method that re-updates every few seconds, but that seems like bad style.
Thanks!
You can use websocket for that. If you are using spring boot, have a look at this guide.
Related
Hello I am wondering if this is possible to notify Android with some kind of listener the best via Retrofit when variable on server side change (to be specific concrete record on database shows up)?
Or you have any other ideas how can I achieve that with the simplest way.
The use case is that: I am developing Android RPG game. There are players that can fight with each other. They are all located on world map and you can choose the player you want to fight with. And now I want to get information in code once I am attacked or inform another player that he is attacked and open a new arena map dedicated for PvP fighting.
Currently I do it by retrofit call to server that checks if that record in database exists every few seconds but I guess it is not the best solution, as some people can have various internet limitations.
Kind regards.
Check out web sockets. They behave as you need.
I need to create a screen that is automatically updated every minute or so with fresh data from a server-based data source, perhaps a simple text file or XML - and is displayed as a web page.
The screen will show a list of items that can be marked with a red, yellow or green icon, as to indicate their status. Each item has a drop-down where you can select/change the current status. So, when a user changes the status for one of the items, every screen monitoring this web page will be automatically updated.
I'm a pretty novice web programmer (I only have experience with desktop programming, VB and a little C#), so I'm really just hoping for a quick push in the right direction here. I assume that this really isn't all that difficult to implement. Am I wrong? And where can I find more info on how to do this? :-)
I really appreciate any help I can get. Thanks in advance!
This sounds like a solution with Websockets. You don't need update every minute. You're able to update every times when a user make changes. Client Side in Java Script is very easily to implement Websockets. Tutorial can be found here.
Server side you need a Websocket Server. What you need depends on which programm language you use.
I'm trying to make an app for website that I DO NOT OWN OR HAVE ACCESS TO ITS DB.
The website is a forum community website and I wish make an app that can list the menu and the posts in a UI suited for mobile.
Also I am trying to see if I add real time notice function that will let the thread poster know when there is a new comment/post to his or her thread. (Website does not support this function)
Do you guys think I can achieve this through Jsoup or would I need other utilities too?
Also I am quite a beginner in java so the app cannot be too complicated.
Thanks.
It means that you want to write your own web browser! You need to call the Url get what it returns, parse it and show it... also you need to implement RSS to specific pages.. It means app need to call this url regularly and check if any changes or comments... Its do-able but wont really be efficient or bug-free... I wouldnt recommend it but as i sad do-able
I implementing an application that has a grid in it and everytime someone changes something on this grid it automaticaly updates the grid for others who has the grid opened (something like what the google docs does).
I tried implementing this using gwt-rpc sending a request every 2 seconds and if there is something new the application just send what has changed. But I had some bad results when uploaded to the GAE server.
So I decided to analyze the google docs implementation and a saw that it keeps a open connection for almost one minute and send some new information everytime someones changes something. I would like to know if it's possible to do something like this on GWT. I'm trying to do it now using the request factory but I think I'll face the same problems.
Any ideas?
Since you use GAE you might want to look at Channel API.
There is also gwt-gae-channel, which is a GWT wrapper around Channel API's javascript client.
You might check out what the GWT folks gave to say about using push technology with GWT
I have basic knowledge of Java but have never developed for Android.
A friend asked me for an app that seems easy enough to develop but I would need some help for Android.
All the app needs to do is send a text field (for example license plate number) to a predetermined SQL Server database.
Is this easy in Android as it sounds?
Thanks in advance. Cheers.
Darko.
That should be easy, but does it need to be a full-blown Android application for that?
Sounds like a simple webpage with an input-field and a submit button would do the job as well.
If you're familiar with using databases from Java the task is very simple. Just write the code that sends a string to a database. The exact same code you would use on a desktop Java application will do.
The rest is a matter of defining your user interface and obtaining the string. There is a good basic tutorial you can use on the Android developers web site: http://developer.android.com/guide/tutorials/notepad/index.html.
The number of code lines in the whole application will be in the range of a couple of dozens.
It sounds like you want the license plate information stored in a separate server, but if you also wanted to store some information on the device itself there is a simple Notepad tutorial provided by the Android Developers site that explains how to setup and utilize an SQLite database on the device. This by no means would replace the functionality of a server, but is another Android feature that is at your disposal.