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:-)
Related
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.
I'm starting a new side project in order to learn some new technologies and I have several doubts about the architecture I should use. My idea is developing an app both for web and for mobile (Android app mainly), so I think I need to implement the following:
REST API service (with django-rest-framework).
Web application (with django).
Android app.
After researching over stack overflow and Internet I have found 3 main "architectures" for the web part (server-rendering, client-rendering, and an hybrid model). In first place my idea was using the client-rendering model (with backbone or angular for the web client). However, I have seen that the hybrid model is a better choice.
So here are my doubts:
1) Could I use django for server-rendering the web application pages?
2) Does Django web app "use" the API or the API is implemented using the same "library" as the django web?
3) Could/should I use a client framework (angular, backbone) for the web client (being server-rendered) ?
Thanks in advance, and sorry about my short knowledge about django, etc.. This side project is just for that, to improve my knowledge about all this stuff.
I don't use Django but I am currently using Angular with Flask as my REST backend. I think the hybrid approach is useful if your app benefits from caching rendered content. An example would be something like a blogging site where you may store Markdown but render HTML and thus the content is largely unchanging. If this content is shared across many users it can be very beneficial to generate once on the server and serve it to many clients.
However if your reasoning is that because mobiles are relatively under-powered server-side rendering will improve the render time, this does not necessarily hold true. Serving the JSON data model will typically result in less network traffic (obviously dependent on browser caching) which is important for mobile client responsiveness.
For my own part I prefer to render on the client and keep the server-side rendering to some very minimal templates. I find this results in a much better REST API that I can then use to provide external developer access or plug in other client UIs. My client code lives on the client side in Angular, my REST interface is clean, and security is always uppermost in my mind because I have to assume that the client code is potentially hostile.
That said I can see a use for server-side rendering even with Angular. For content that is fairly static it would be great to generate this server side, cache it, and then ngInclude it.
I need to build a cross-platform app (IOS + Android) that requires some web scraping capabilities. What I need it to do is to login on certain sites, grab the relevant information and present a combined overview of data from these sites.
So is there any way to accomplish web scraping in phonegap?
It's easy, just use Ajax to request a page.
Use something like JQuery to make the Ajax easier to work with.
Use JavaScript's regular expressions to extract what you want from the Ajax response. You could also use a Dom parser library of some sort as well for more direct access.
Make sure you have your PhoneGap config set up correctly for making Ajax requests. See AJAX Request from Phonegap Android fails
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?
In the past I have used Python for backend stuff along with Django for frontend stuff, but I don't know how well those two work with Android.
Can anyone recommend a good way to go about making server-side software that works well with Android?
Please take into account that I also want a web application as a frontend, so the backend should work with both the web app and the Android app.
Thanks for the help!
You might start by developing an HTTP API using Django, tornado, cherrypy, or any other web framework. This API may then be used by both your web frontend and your Android application.
In general, separating out the API from the application serves to clean up the code and make future changes easier. In this case, it also makes it easy for you to have multiple frontends without having to replicate the backend functionality.
If it's possible to create a web application version of your project, consider that it may be easiest just to create a version of that application which is formatted for the android screen, and allow Android users to use the same web application with appropriate styling.