Maximal reuse: Webservice, Android client, Web Client, how? - android

I need to build a simple web service in Java, the context is Google Application Engine.
Two clients are needed as well: Android and Web Page, for browser.
I consider something like Restlet, and want to re-use from it Android and GWT clients.
Could, you, please, give me a hint, whether it is a good way to go?
Could you advice others?
In particular, I could not find, how this technology coexists with WSDL, and if
I am going to be able to use it?

Restlet Framework is mainly used to develop RESTful web services, even though in practice you can also issue and receive SOAP calls to bridge with older systems (no WSDL support though).
For help on GWT and Android client sides, see:
http://wiki.restlet.org/docs_2.1/13-restlet/21-restlet/318-restlet/303-restlet.html

It depends a lot on whether you wish to build cross platform as in phonegap or keep it simple as in mobilewebapp example provided in sample folder in gwt zip file you download.
The mobilewebapp sample does not access smartphone features but will be accessible by browser on any mobile. phonegap or similar frameworks like titanium,sencha provide api to access smartphone features.
Fore more information -
http://www.sapandiwakar.in/technical/api-research-study-iphone-and-android-applications/
Sencha Touch 2 native build vs wrapping Sencha Touch 2 in Phonegap
Creating a mobile app using Google App Engine and GWT?

Related

From ruby on rails website/webapp to Phonegap Android app?

I would like to ask for some advice on this issue I am having. I am working on a website that is made with ruby on rails (along with html.slim, css, angular.js).
I would like to create an Android (and, if possible also iOS/Windows Phone) app to access a part of this website.
The website does nothing more than making some api calls to a server and it's really light, so I think that I don't need to make a native app. I would like to make this app in the fastest and easiest way possible. I thought that I would be able to make convert the site using Phonegap, but this would work if it was made only with html,css and js, not also with ruby on rails. The only thing I need is to store a small string on the device (the website stores a cookie) and then to make a few simple API calls.
Thank you for any advice on this - not so clever - question.
Bye!
PhoneGap, Cordova, Ionic, etc. - all the same. None of them will run your API (aka server side code - PHP, Ruby, .NET) without doing something dramatic.
Easiest approach - write server side services (e.g. REST services) using your favorite server side code - like Ruby, and use JS to securely call into those services.
This fits the PhoneGap/Cordova/Ionic paradigm, and will allow you to build a hybrid app (aka seemingly native app) the quickest.
Just my 2 cents.
Maybe (if you need real simple app for mobile platforms) you should create Android/iOS app with browser object inside app who will be receiving html data from your public website and show it for user. You just need to create mobile layouts in your rails application.
pros:
You can create this app real quickly;
Easy for update;
Don't need to update app if something changed in general web application layouts or logic.
When you create layouts for mobile they will be work for your applications and for mobile devices who doesn't use your app.
cons:
This is not classic application, it just browser inside your app.
It is not a bad solution for start. For most sites, and projects it will be enough.
More information about rails and mobile layouts for rails you can find here:
http://railscasts.com/episodes/199-mobile-devices
Example how looks like android app with browser (Webview) object:
http://www.mkyong.com/android/android-webview-example/
https://developer.chrome.com/multidevice/webview/gettingstarted
I'm sorry if this is not the answer you were looking for.

Communicating to the restful web services in Phonegap

I want to built a mobile application using Phonegap that will communicate with the restful web services and parse the json data.There are two ways two do it:
Calling restful web services using http connection in Java and connecting the Java code to JavaScript file by making our own plug-in in cordova.
2.Making ajax calls to communicate with rest services.
Which one is better considering the needs below:
1.It can call https web service,since for https in android we need to include certificates,create bks file for that which includes lot of mess.
2.It should be able to receive and parse the json data and render it to the html page.
3.We need to built this app for primarily android OS but if we can built it for ios,windows etc. It would be better.
Please tell me if i am using right tool,if sencha touch is easier to perform these tasks?
I would suggest that you use AJAX because it completely fits all your needs, and you gain to use the same code for future use if you'll ever decide to build for more platforms.
moreover, why make things complicated? you already writing your app using javascript, so don't mix it with native code when its unnecessary.
The fact that you choose PhoneGap, it is an indication that you are wanting to re-use your HTML/JS/CSS expertise as much as possible. Say if you choose jQuery Mobile (or any other framework) for your project, jquery provides ajax for your needs already and there is no reason to go down to the JAVA layer.
That said, the right approach should be using the ajax mechanism provided by your javascript framework. This is your option-2 and you won't need to build the raw ajax utilizes. Like if you go with jQuery/jQueryMobile + Backbone + backbone.marionette (we happen to use them in phoneGap app), there are a lot of add-ons out there to help. Like in this example, it is actually part of the phoneGap app under 'www' directory.
Also the communication to the webservice is your least concern if you have all the tools. Making suggestion on what tools to use is not allowed by Stackoverflow:-)

Developing a Java Cross platform library (mobile and web)

There are so many cross platform libraries that I am kinda lost to get an answer to a very basic java question.
I have a java library that works well on Android. It does not use any android specific functionality and also builds on the standard java sdk. This library uses sockets (plain simple Socket, ServerSocket kinda architecture) to communicate between the library and a server hosted (may be on a ec2 or some virtual public server).
Now my question is, can other developers import my java library (built using java sdk) to a application that uses html/css for User Interface, package all of this into a mobile application for iPhone (use native iPhone packaging, and a WebView to launch) ? Also can I ship this library so other software developers can build a web application to work on desktops and cross browser's ?
Some questions on stackoverflow are close to what I am looking for, but not quite there.
Developing Mobile Apps for Multiple Platforms (without a cross-platform framework!)
Will a webserver be able to use my library that connects to the server using sockets ?
And will every client that connects to this webserver create a new instance of my library ?
If you library doesn't use any dependencies on either Android or any other library, another developer can use it pretty much anywhere they want. Although keep in mind that platforms like EC2 may have a preferred way of using communication. (I'm no expert on EC2, so you'll have to see what they use.)
So I guess it's better to abstract out that socket functionality for good.
I don't think you can use a Java library in iPhone. iOS terms of use clearly states that you cannot use a compiler or interpreter on the device other than the one given in the SDK and the webkit javaScript engine in Safari. So there's no way your Java code is going to run on iPhone (without jail-breaking.)
I don't understand the question about webView. Do you mean navigating to a site that is powered by your library ? If yes, then yes as long as you keep it in the boundaries of Safari. (no Flash, no Java Applet .etc.)
Will a webserver be able to use my library that connects to the server
using sockets ?
For the most part, yes. But as I said, the platform may not allow raw connections, so it's good to abstract it out.
And will every client that connects to this webserver create a new
instance of my library ?
This depends on the design of your library and its public APIs.
Hope this helps.

Is PhoneGap the right choice for me?

I am new to PhoneGap, and I have several questions:
I need a way to develop an application that will have iOS, Android, and other platform compatibility. In other words, I want to write 1 app and get compatibility versions for different platforms.
By reading the "Get Started" guide linked by the PhoneGap website, I found there are different procedures for different platforms. So to have compatibility versions across platforms, do I have to go one-by-one and change all of them if I make a modification to my app?
Also, what exactly is PhoneGap Build? It seems like I can avoid all that hassle mentioned previously and toss my app into the PhoneGap Build? Do I really not have to do anything besides writing the app? What if I need to make changes?
And finally, I've read that PhoneGap works with HTML, CSS, and Javascript, but not PHP. What if my app needs to contact a server? Can PhoneGap handle that?
Thank you for bearing with all these questions!
PhoneGap achieves platform compatibility by embedding a webview within your application. Therefore you can apply your knowledge in HTML, CSS, JavaScript and it additionally provides ways to interact with native features (e.g. camera, gps, ...).
With PhoneGap you write one general web app, tweak parts for the specific platform (sometimes you do not have to this at all) and build it for that platform. The latter can be handled with PhoneGap Build service: It takes your webapp and bundles it for the mobile operating systems out there (Embeds it within a Java app on Android, an Objective-C app on iOs)
PhoneGap is able to communicate with a server hosting a PHP script just as every other web application. Trying to dynamically load resources from remote sites can be quite a hassle but this is another question.
traumalles is correct. All your HTML/Javascript/CSS is running from within a webview on the device. Your code is, therefore, all "client-side." You can communicate with a server just like with any other page. When they say PhoneGap isn't compatible with PHP, they mean only that PhoneGap can't execute PHP code like it's a server, because it's not. It's just loading your webapp in, basically, a browser.
One other important question is what exactly do you mean with "other platforms" phonegap does provide many functionality for nearly every platform but the different webbrowser of the mobile devices have their problems and limitations.
For example are there many problems if you want to provide your application on a WindowsPhone Device because the Webbrowser has a few limitations which will cause your app to not look and behave like a native app.
Just look a bit through the phonegap API you will see that some functions are just available for IOS or for Android and there are a few only Blackberry methods and so on.
So you really have to be careful when a framework tells you it will work on all devices.
So i really don't have a problem with phonegap i worked with it very great but there will be limitations you have to deal with.
If you primarily want to develop for IOS and Android you can really achieve great native like results !

Building mobile app derivative of Rails web app

How does one approach building the mobile app version of one's Rails app, with little to no mobile development experience? iOS, Android, one or the other, or both.
First, you might want to create (private) APIs for services your web app provides. The de facto standard for Android apps is REST-like endpoints that accept/return JSON. You can use whatever Ruby REST framework works best. Then you need to consider how you would authenticate Android apps, if needed. Do you use the same authentication database? Can you allow anonymous access, what parts of the app do you expose, etc.
Finally, you need to build the frontend. A few options here:
learn Android
hire someone to do it
use a framework that lets you develop using Web(-like) technologies: Thitanium, Rhodes, etc. The upside is that you get to use what you know and might also get an iOS app for free.
The downside is that you can never get the native performance, and look-and-feel might not be completely Android-like (never used Rhodes, so maybe it does this well enough, but still)
Consider using http://www.rhomobile.com/.

Categories

Resources