wood burning stoves 2.0*
The moose likes Android and the fly likes Android app connecting to a server in a client/server capacity? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Android app connecting to a server in a client/server capacity?" Watch "Android app connecting to a server in a client/server capacity?" New topic
Author

Android app connecting to a server in a client/server capacity?

Sam Lanza
Greenhorn

Joined: Nov 09, 2007
Posts: 17
I have this idea for an app that would require connecting to a server and then downloading a text file (comma delimited). The idea is to have a central server that the app on an android phone can connect to. When it connects, a list of all the text files on the server would come up to choose from. When the android user selects a file, it automatically downloads to the android phone. So the app in question would need to connect to the server, see the list of text files on the server, display the list to the user in presentable fashion, download a specific file chosen by the user, and then finally pull the contents of the file into the app. Also, there would be the ability for individual users to upload additional comma delimited text files. The idea is that any random user of this app would be able to connect to that same server and see the same list. Would something like this be possible? And if so, is there a free way of doing this or would this take renting out server space? I haven't the first clue how something like this would work and would appreciate any helpful advice. Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Not only is this possible, but it seems very standard fare for a mobile app. But yes, you would need to buy server space. It's possible you might find free server space somewhere, but you'd have to ask yourself whether you could rely on it to be available for the lifetime of the mobile app.


Ping & DNS - my free Android networking tools app
Sam Lanza
Greenhorn

Joined: Nov 09, 2007
Posts: 17
Ulf Dittmer wrote:Not only is this possible, but it seems very standard fare for a mobile app. But yes, you would need to buy server space. It's possible you might find free server space somewhere, but you'd have to ask yourself whether you could rely on it to be available for the lifetime of the mobile app.


Any advice on a book or website detailing this process? I'd appreciate it.
Sam Lanza
Greenhorn

Joined: Nov 09, 2007
Posts: 17
Also, can you build a Java Server that talks to Android and iphone apps? I'd like to build something where 5 different people with android and iphone phones can be tied together by a Java Server.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
I don't know that you'd need a book or anything - wouldn't HTTP communication be sufficient? Select a Java hosting company (like one of the ones listed in the ServletsFaq), and write a Java web app using servlets and JSP to handle all the traffic.
Sam Lanza
Greenhorn

Joined: Nov 09, 2007
Posts: 17
Ulf Dittmer wrote:I don't know that you'd need a book or anything - wouldn't HTTP communication be sufficient? Select a Java hosting company (like one of the ones listed in the ServletsFaq), and write a Java web app using servlets and JSP to handle all the traffic.


This is all very helpful. I appreciate the sage advice.

One last question: From what I understand of web applications, they run on the server and act as the server portion of the client/server architecture. The web applications serve web pages to the client (the browser). This works perfectly well with desktop and laptop computers. Does the concept work the same for iphones, androids, and tablets? Do they essentially get served web pages from the web application like desktop/laptop computers? If I had to guess, your app would have to somehow use the browser in the smart phone/tablet to display the pages served up by the web application. Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
Do they essentially get served web pages from the web application like desktop/laptop computers? If I had to guess, your app would have to somehow use the browser in the smart phone/tablet to display the pages served up by the web application.

You could write a mobile web site that displays well on small screens -so that folks could use the browsers on their mobile devices to access it-, but for an app you'd generally create web services (possibly implemented using REST and JSON via a library like Jersey), since the UI would be supplied by the mobile app. The app might use the HttpClient library that's part of Android to access those services.

You could also create a "hybrid" app that embeds the Android-native browser component in your app, thus allowing you to do special things with your web app being displayed within the mobile app. (And you could use other web services provided by the web app on top of that.) The Android class to use in this case is android.webkit.WebView; see http://developer.android.com/guide/webapps/index.html for more details.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Android app connecting to a server in a client/server capacity?