I am learning to develop Hybrid Application for Android platform (which will be extended to other mobile platforms later). I have read a number of articles and have got a start but have not come across something which explains this.
I want to store the UI (HTML/JavaScript/CSS) files on the mobile device and display it via the WebView. This will communicate with a remote server to fetch data via a WebService.
What I have not understood specifically is:
Will the UI files (HTML/JavaScript/CSS) be installed on the file
system of android device or will there be a local embedded WebServer
on the android device.
If the HTML/JavaScript/CSS files are on the file system how do they
communicate with the remote WebService. Let’s say I want to make an
AJAX call to the remote server… will it be handled by UI
(HTML/JavaScript) files displayed via WebView or by the JAVA
Container in which the WebView is sitting in? What I did not
understand is how can an HTML/JavaScript sitting on the file system
make AJAX calls.
If a local embedded WebServer is required on mobile device can you
suggest me some? And if this is true will the same architecture work
on others platforms as well like iOS, Symbian, BlackBerry etc.
If anyone feels this is not the right way to go please let me know your thoughts on the architecture.
Kindly point me to the right articles or explain your thought on this particular scenario.
I would suggest you to go with a different approach for these problem. Had I been in your place I would have done the following:
I am assuming that you are making these as a java based web application. Even of you go for PHP or other web development language things will reamin pretty much the same.
1)Will the UI files (HTML/JavaScript/CSS) be installed on the file system of android device or will there be a local embedded WebServer on the android device.
No. The UI files that you are toking about are nothing but web pages in your web application. these web pages are stored on the server not on your local file system. We make use of browser to connect to the remote server these pages are then fetched from their by your browser processed and then displayed to you.
2)If the HTML/JavaScript/CSS files are on the file system how do they communicate with the remote WebService. Let’s say I want to make an AJAX call to the remote server… will it be handled by UI (HTML/JavaScript) files displayed via WebView or by the JAVA Container in which the WebView is sitting in? What I did not understand is how can an HTML/JavaScript sitting on the file system make AJAX calls.
Web page is downloaded from server and displayed to you in your browser. In the web page itself we write scripts to make AJAX calls on appropriate events like on click of some button, or change in value of some field or # the time of page load etc. When you want to make a AJAX call is all dependent on your project requirement.
3)If a local embedded WebServer is required on mobile device can you suggest me some? And if this is true will the same architecture work on others platforms as well like iOS, Symbian, BlackBerry etc.
Now as I have mentioned earlier that the data is stored on the remote server so you dont need a web server on your mobile device (unless you want to use your mobile device as the hosting or server device). As these is a web based solution you dont have to think about the platform of your mobile phone. Be it a android, blackberry, Apple or a symbian phone all you do is connect to the server with the web browser that is their in your phone.
Related
I am currently working on an app for android devices. However, the application is too big to build for the device. Therefore, i want to build the core of the application (the part that does most of the work) and place it on a server, and build the light weight part of the application for the mobile device. The App on the android device is to connect to the application on the server, and collect the processed information. I want to build the application that is to run on a server with the Python language, as the application I'm working on does a lot of numeric crunching. Is this possible? If so, how can i embed my Python script to a web server and how to link it to my application
On the server side I would suggest looking the Flask framework (you may find the Flask-Restful framework and having the mobile app accessing it via a REST API. This may be useful depending on your Android experience: http://developer.android.com/training/volley/simple.html However, if you are doing a lot of number crunching, you may need to use WebSockets to connect the two and run your processing in a background thread. In which case I would look at http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps and https://flask-socketio.readthedocs.org/
What I want to develop: Crude Overview?
Suppose 10 web links present on my (native/web) app, and user will scroll through links. And when user clicks on any of the link, it will open that website. And user might wish to close this website and again views the list of those URLs on my app and the cycle may go on as per his wish. Also, user can create custom list of those links. Also, these lists will be updated regularly, may be on monthly basis. Which I guess I just need to update data files and not app.
No, it is not similar to browser bookmarks but in very crude terms you can relate it. Anyways, I will accessing user's bookmarks with his permission which I guess can be easily done with the APIs available.
Right now, technologies in my mind.
1) Phonegap ( to be precise, its phonegap build - as I don't have MAC) with JQuery mobile and deploy as native app,or
2) SenchaTouch and deploy as web app or native app using sencha cmd.
3) I want to use MongoDB along with above 1st or 2nd option. Is it required or JSON can suffice? Also, I may need some security by encrypting this data while storage at user's mobile and also while collecting user's custom lists.
4) In future, I would also need Node.js for the purpose of collecting MongoDB or JSON data files in above 3rd point. Is there any other way so that it can be integrated with phonegap or senchaTouch.
Please suggest things if existing resources can help me develop my idea and guide me what to use!
Note: All technologies I am picking up are focused on single code base with minimal focus on platform specific changes-iOS/android/Windows/Blackberry.
I want to go for Native app rather than web app. Why?
1) I feel that it would perform faster if I deploy my idea as android/iOS/Windows app rather than web application.
2) My cost of hosting the application on server will go to null because I am using local storage of the user's mobile.
3) Since I want a feature in my app which stores user custom settings so it would be better if I deploy it as mobile app rather than web app so that I don't have to maintain user specific settings which may make my DataBase hosted on server to grow immense in future.
4) Also,I feel that there is no sense in hosting this application on a dedicated server because there would be less user interaction with my backend. But later I would plan a feature to collect data/settings done by user to improve feed for which I think I need to use Node.js. But then also there is no requirement of hosting frontend to a dedicated server. Hence, I can use dedicated server to serve my own purpose of analytics to improve feed rather than service user's purpose of unnecessary access to my web application always through the server and fetching lists of links which are maintained on server in custom manner for him.
My dilemma!
My above points are valid to prefer deploying as native app over rather than web app. But I feel what if I keep my app as offline web app which runs on the default browser of the user but loads the jquery and other data and scripts from the storage in mobile. Is this possible? I am unaware of this.
If this is available then it is the best thing for me to adopt as my application redirects to other websites. Because, if I am deploying my app as native app then it would ruin user experience of opening my app and selecting an option whose URL opens up in default user's mobile browser which is a different app and then there are many chances that user will switch back to my app and then again he would be redirected to that mobile browser. And obviously I cannot develop my own browser in my app as I would have to develop several things from security and other perspective which would be a cumbersome task. So, having my offline web app will be opened in user's default browser itself without annoying him to switch back and forth between my app and browser as in previous case and thus creating seamless experience.
Also, I am not sure whether we can create offline inbuilt browser plugins as we can do in chrome browser on desktop. If so, then I think I would have to concentrate differently on different mobile browsers Safari, Chrome, mozilla which I feel is not worthy. Please throw some light on this for me.
I have no idea why people are downvoting my question as I feel that it is kind of unique question.
Here is what I found more and with the help of my friend
1) I don't have to use MongoDB as my application is not much complex. So simple JSON will suffice.
2) I'll be using Phonegap for android and windows phone and phonegap build for iOS along with jQMobile. So the app will be in the native form only.
3) I'll be using inApp browser for seamless experience although it is not as perfect as having my idea as web app.
4) No need for senchaTouch as it is heavier than phonegap and not required for me idea.
5) My next look forward is comparing the above points with offline web app built using JQMobile and JSON and finally whatever I decide I will share.
EDIT:
I am finally going with phonegap for native deploy rather than offline web app or web app hosted on server for reasons that I found on several blogs.
People downvoted my ques so I feel that it is not worth writing answer further but if you want the detailed reason you can always add a comment.
Thank you
You should definitely go for web. It is cross platform. If you do an android App, or iOS App, they are restricted to the specific devices. So I definitely recommend Web App
I need to create an application that does the following:
Is available for Android and iOS devices primarily, Windows phone support would be nice
Allows the user to use the app offline
Allows the user to download files (PNGs and HTMLs) from a webserver to be displayed later within the webapp (needs to be able to be viewed offline)
Doesn't require user to redownload all the PNGs and HTMLs if they clear their browser cache (would be nice if there was a way to keep them from clearing the web app cache too, but I understand if this is not possible)
What tools do I use for this? So far, I'm at HTML5 web app and I understand how to cache the site, but how do I get the files (PNGs and HTMLs) to be saved locally and not subject to being cleared should the user clear the browser cache? Is native for iOS, Android, and Windows the only way to go here?
Any help is appreciated...
If you want your app to work on multiple platforms and be available offline, your best bet would be to wrap your app in something like PhoneGap and package it up for the various platforms.
This allows for one common "HTML-based web app" code base but will require compiling for the different platforms respectively.
I'm building a mobile app for Android and iPhone using Phonegap. I was planning to keep all html, css & js files on my web server and serve from there only using webview. I am confused about it. Is it possible to do that or do I have to bundle with Phonegap? I have also seen this but this post is one year old. Are there any changes?
Please provide your views.
Thanks
Bhupinder
You are far better off packaging the resources (html/css/js) with the app. If you load everything remotely you are risking: A) being rejected by at least Apple's app store and B) network latency causing your app to be unusable.
You can absolutely do this. you can load css, js and html from server. But it almost look like a mobile website and more over you cannot control the pages with your phonegap events like sensors, battery and notifications, etc., It is purely like a website only. If your net is fast, definitely page loads also fast from loading web server. The main point is you cannot interact users with your app like normal android apps. you can just use like a mobile website. So what i prefer is loading from mobile as package is better and it gives a real application experience rather than a website.
Yes, you can do it but it will be rejected by the apple app store first. Also in case of network failure or slow internet connection, your application will be of no use. So i suggest to avoid this as this will be a mobile application, not the website.
I’m developing an Android and web application that will function as a service (use the same data).
My question is how should the data be stored to allow for both the web and the android application to have access to the same set of data?
Should the android application connect to the sites MySQL server to store/access data?
If so how do I allow someone to access the data when they are not in a service area?
It sounds like you need to provide a REST or SOAP interface to the data on your webserver so that the Android app can get at it. As for providing access when not in a service area you would need to cache the data, or provide some sort of full data sync capabilities, to keep a working copy of the data on the Android device. I would recommend against letting Android devices connect directly to an external database, if that's even possible.
Do you have a fully functional web app that you are just copying as an Android app? If so I would suggest that you consider just letting Android users view your site via the web browser. Perhaps provide a more mobile friendly version of the CSS. This will get you Android, iPhone, Blackbeery and Windows Mobile support. If you need that webapp to be accessible when devices are not in a service area you could look into Google Gears or HTML5 client side database support. That would make your webapp accessible on Android devices that aren't in a service area (not sure about Gears or HTML5 support on other mobile devices), and it would also provide that functionality on notebooks/netbooks and other portable devices that might go in and out of service areas.