File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Android Development for client / server architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Android Development for client / server architecture" Watch "Android Development for client / server architecture" New topic
Author

Android Development for client / server architecture

Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Hi Everyone,

Since this weeks hot topic is web apps for Android I would like to ask if there is a 'preferred' architectcure or approach to developing web apps and / or extending them with rich clients for offline use. I am curious how an expert might approach a scenario like this. Can a web app be made for offline use like with Gears? Do I even need to worry about a client app per se?

Any thoughts appreciated

Cheers

The Frog
Sebastien Blanc
author
Ranch Hand

Joined: Nov 18, 2004
Posts: 33
Hi Andrew,
There is not really a preferred architecture, depends what are the needs, you could us a classic 3-tiers architecture or maybe a more "modern" cloud based architecture(google app engine, noSQL db etc..).
Regarding the offline aspect, well in chapter 6 there a whole section on how to leverage the power HTML5's offline caching feature which will make your web app also available when there is no connection.


Sebastien Blanc
Pro Android Web Apps: Developing HTML5, JavaScript, CSS, and Chrome OS Web Apps
Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Hi Sebastien,

Thankyou for getting back to me. You mention HTML5's offline caching feature. Just how complex and large a 'thing' can you keep as offline? The whole app itself like a java webstart? Some persistant files? Does this limit you ability to work with the existing Android infrastructure like SQLite or do you have access to the lot (sensors etc...)? It would be very cool if you could do everything a 'regular app' can do but with a web app designed for Android. It sounds (or at least my interpretation) too good to be true! Am I missing something?

Cheers

The Frog
Sebastien Blanc
author
Ranch Hand

Joined: Nov 18, 2004
Posts: 33
Hi Andrew,
With offline caching you can cache every static resources you want :html,css,javascript, images. You persisted data can be stored using Web SQL or localStorage. So yes, it can acts as a native app, you can even add GPS support and device orientation detection. But if you need to access the camera or the accelerometer then you will need to package your web app into a native app, that can be done with PhoneGap for instance and is just a matter of some clicks.

Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Sebastien, once again thankyou. It seems that you can do a lot with web apps but not everything. Is there some sort of official specification for what can and cannot be done? I have a specific application in mind (using tablet's for gathering data in the field in a structured way) and would like to dig around the topic some more? Do you know of such a specification with regards to Android?

Cheers

The Frog
Sebastien Blanc
author
Ranch Hand

Joined: Nov 18, 2004
Posts: 33
Hi,
There is no official specs of what can/cannot be done compared to a the native SDK but you can have a pragmatic approach, for example if you are planning to build the next killer First Person Shooter for mobile you probably won't choose a Web Based App.
But if you tell me a bit more about your app, I will maybe be able to say if it's doable with a Web based approach.
Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Thanks Sebastien, that is a most generous offer.

Well, simply put the application in mind is a 'shelf scanning' application. The idea is that ssomeone can go into a retail store or supermarket, scan the barcodes on the products, have a few 'special' codes probably done at a touch of the screen for things like items stacked two high or other such scenarios (end of row on shelf), and enter the price of the article. This effectively captures a type of picture of the shelf itself. The data would then be sent bacck to a central database where the shelf design can be compared to the sales performance of the store and its articles. This would help retailers to identify both dead areas in their store as well as articles that take up too much space, or dont have enough, etc....

Most of the heavy processing would be done on some server arrangement, but the shelf capture is best done in the hand. If the retailer wanted to they could contribute the product data and pricing to a 'global' database and maybe gain a few sales from price competition or simply adjusting their own prices relative to others.

This is an area I have spent many years dealing with but never found what I believe to be a simple and reliable solution. You usually get one or the other but not both together. Existing software for this area is all windows based and extremely expensive, so it puts it completely out of reach of the little guy. The goal of the software would be to correct that and help make the little guy as capable as the big guy - or as close as you can get. I have the knowledge and experience to build such things, just not yet with Android. Android is still new to me from a programming point of view but I firmly believe that it is the best thing to happen to embedded hardware since electricity, and being able to combine that with a web interface to the parts that do the heavy lifting makes a lot of sense to me.

There you have it. Nothing super complex but it might just be pushing the limits a little from the sound of it. Still, I think the reward could be worth the risk :-)

Cheers and Thanks

The Frog

Sebastien Blanc
author
Ranch Hand

Joined: Nov 18, 2004
Posts: 33
Hi Andrew,
This is a great concept and I'm sure you will be able to make it a success !!

Well the good news is that it's doable with a Mobile Web App if you agreed to use a bridging framework like PhoneGap. Why ? Because you need the camera and that's all. And in the future is more than probable that the camera will be accessible directly from the browser.
As you mentioned, the core business logic will occurs on the server side and I think that it's the area where you will have to put the most effort. The another good news is that there are some excellent books ;-) that will help you to create the frontend application, adding the camera support is really just a matter of minutes onces you're confortable with the Mobile Web App development processes and have some basic JavaScript knowledge.

You could also easily add some Geolocation support, so when the picture of the shelf is taken it also automatically retrieves the shop based on its location.

The benefit of building a web based app will also be the fact to it will be easy to deploy on the different mobile platforms and provides automatically updates of your software.

You have a great idea , go for it !!!
Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Thankyou Sebastien. I really appeciate your help and guidance. I am really looking forward to this and I appreciate the encouragement too :-) Thankyou for taking the time to answer an Android noobies questions and point him in the right direction. Congratulations on the book and all success to you.

Cheers

The Frog
Damon Oehlman
author
Greenhorn

Joined: Jan 26, 2011
Posts: 23
A big +1 on all Seb's responses here, and I'd also just point you towards the thread below that talks about PhoneGap plugins:

http://www.coderanch.com/t/525012/Android/Mobile/Does-Pro-Android-Web-Apps

As soon as you said "scan the barcodes" I remembered that I saw a PhoneGap plugin that has already been built for that:

https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner

While I haven't tried it myself, I expect it should be pretty simple to implement. We have a little coverage on using PhoneGap plugins in chapter 12 in the book if you are after some guidance on the topic.

The plugin would probably give you a bit of a leg up in terms of getting your application started, although it does seem to rely on another app.

Cheers,
Damon.


Damon Oehlman
@DamonOehlman - Web - Blog
Andrew Hogendijk
Greenhorn

Joined: May 19, 2010
Posts: 12
Thanks Damon. I will be sure to check it out. Developing for Android is a new challenge for me and any leg up on learning is plus. Many thanks.

Cheers

The Frog.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Android Development for client / server architecture