I am developing Android Web App using JSP with xml parsing. I developed it in Java using Tomcat Server but I couldn't develop in Android. I am new to the web app development. So can anyone kindly suggest me how to proceed further...
waiting for a response guys...Thank you
It is likely that you don't need tomcat on android. After all tomcat is (apart from everything else) a web server. This means that the phone your app is run within should be serving requests from other clients. I doubt you can make sure your phone IP is fixed, and even if that's the case, phones are not meant to be servers.
What I suspect you have done is - you've implemented some functionality in the context of JSP and servlets, but this functionality can easily be run without jsp/servlets. Remove the servlet-api.jar from your classpath and make your functionality work without these. Then you can easily use it in an android app.
While it should be possible from just the hardware standpoint, it should be nearly impossible to get tomcat running in the dalvik pseudo-java envrionment that android provides. the dalvik vm that Android uses is not a Standard Java VM, hence tomcat can't run on it.
I would suggest to look into the Maemo world, specifically the n800 and n810, which are a bit more hackish but also a lot more closer to linux than android. I've successfully run OSGI based apps on those machines. And they are still mobile devices you can use.
Check this site for some examples: http://wiki.maemo.org/OpenJDK_6.0_0_%28Cambridge_Software_Labs%29_on_N900
Look at i-Jetty. It's a web server that runs on the Android platform.
Why crazy? It is possible to make an ip pseudo-staic and then use a phone or tablet as a server instead of running a big power consumpting desktop 24/7. Of course for very simple purpos3 and probably as an experimental stuff. But not bad idea. I have written few years ago a tool for intarnal lan communication in the company which comprises synced and asanced messaging sastem, files and folders exchange functions, firewall solved access and everything in one jar cca 390 kb without any dependencies...there is also built in a http servlet and it runs on dalvik without problems - I have tested it. So the way is there, Even if the intention is not 100% clear.
You want to run Tomcat inside Android using dalvik? That is crazy. If it is a Web App host it somewhere and use the browser.
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/
I am creating an app in Android which will also be made in iOS after it's ready.
I have successfully implemented a Tomcat serverlet in Eclipse between the device and the server.
Now both these platforms use Java. This isn't the case with iOS, which I am aware that you can't program with Java, but what about the serverlet? Can I even use Tomcat?
Some guidance will be much appreciated!
Yes, you can use ApacheTomcat.
Tomcat is only the part of technology to host your Servlet.
This has nothing to do with the mobile apps that you are planning to build, since these are completely different components.
As I see it, your whole project will require to be implemented with three different technical components:
Your backend: This is your Java Servlet. It needs to run in a Servlet Container, which is indeed your Apache Tomcat setup
An Android app: Written in Java, talking to your backend via HTTP
An iOS app: Written in Swift/Objective-C, talking to your backend via HTTP
Is there any way of developing a mobile app as a self contained Rails/Ruby app?
The idea is to develop in Rails using the normal tools (browser, thin/WEBrick and command line) and then add the Rails app folder to a specially created Android/iOS app, from where it will be compiled to a native executable. This would be similar to the current PhoneGap creation process I guess. I know about RubyMotion but its iOS only, and its not completely Rails anyway.
Does anything like this exist currently?
What would you need to do this? Obviously you need to run a local webserver of some kind.. Do you need to run an entire stack (Apache, Ruby and Rails) inside the native app or could you take shortcuts (like JRuby for Android for example)?
What is your gut feel on how this would perform?
Any thoughts welcome.
EDIT
Gems are probably going to be a BIG issue as well.
Does anything like this exist currently?
Rhodes is in the ballpark, but it is not Rails and (last I checked) cannot use gems. It does, however, have you build so-called hybrid apps using a Rails-ish controller pattern, with partials and all that.
Obviously you need to run a local webserver of some kind
Not necessarily, and it would be an poor idea to do so for security reasons. Hybrid apps, such as Rhodes, have a Web presentation layer (WebView) displaying the HTML content generated by the back-end, without an HTTP stack.
What is your gut feel on how this would perform?
On many devices, I suspect that your app would crash on startup for having run out of memory. On the rest, I would expect mediocre performance, simply because Rails is not particularly svelte.
The strange thing is that you want to use web application as mobile application. Is there a reason to use Rails instead of just Ruby (then you have Ruboto on Android). My opinion that HTML5(+ local storage) is enough to serve mobile part and use API from somewhere on the web.
Firstly I would like to thank all the experts here on stackoverflow, by reading questions asked and looking at example code and reading the answers i have been able to get to this point. Thank you once again!
I have been spending hours and hours searching for a solution, I’ve read through many posts on this issue. It’s seem this is a issue a lot of others are/has been struggling with.I would highly appreciate any more advise or tips if somebody can assist in this frustrating issue.
All my development are done on my local machine. (Win 7, Visual Studio 11beta)
A WCF Service is hosted in IIS Express on its own port or IIS 7.5 (.Net Framework 4.0)
Second Web Application with only Html5/jQuery is hosted in IIS Express on a different port.
Using Eclipse 3.7.2 with Android SDK 17 also on my local machine.
Its seem all the software are functioning properly.
Android Emulator is working, Phonegap/Cordova library is installed, etc.
I am using Android 4.0.3 with Cordova 1.6.0
I am asking assistance to find out why my phonegap emulator ajax call won’t go through to my WCF REST Service. I don’t have a actual android device now to test the program on at this moment therefore I must use the Emulator.
Some more detail:
I have a WCF REST Service developed in .Net receiving & sending in JSON and JSON-P.
I have tested this with a second web application on a different port to make sure cross domain calls are allowed.
I have also used the RESTclient plugin for Firefox and can use it to make JSON and JSON-P calls successfully. [ http://restclient.net/ ]
So I am sure the WCF Service is working as it should. There shouldn't be any cross domain issue.
When I take the Html file with jQuery that I know is working within Visual Studio, to eclipse, copy into phonegap app, I try to make a basic call to my WCF server and I am unable to connect to the server.
I have changed the URL from [http://localhost:50425/LoginService.svc/GetData] to [http://10.0.2.2:50425/LoginService.svc/GetData]
according to android documentation : [http://developer.android.com/guide/developing/devices/emulator.html#networkaddresses]
I have created an allow all whitelist with the following setting:
[ access origin="*" ]
within the cordova.xml file. See: [http://professionalaspnet.com/archive/2012/05/15/Whitelisting-Domains-in-Cordova-_2800_PhoneGap_2900_-Android.aspx]
The correct permissions have been set inside the AndroidManifest.xml file according to [http://docs.phonegap.com/en/1.8.1/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android]
When I initiate the call, I use $.ajaxSetup error function to trap network error etc. and display with alert the error message. Used console.log() to make sure it passes this function without a error.
When the call actually happens, I receive a "Bad Request - Invalid Host Name. HTTP 400. The request hostname is invalid."
If the call would have been successful, I use breakpoints inside Visual Studio to know for certain the call has been made and see the request coming through.
Is there any other ways to test from emulator if I can access the "external" host? In this case to make sure emulator actually can find the service?
Is there any tools or other configuration settings that needs to be done?
I have even deleted my emulator and created a new one but it still fails to connect to the WCF Service.
I would really like this to work, would like to build a complete phonegap application but can’t continue if I can't make a call to a web service.
Any advise would be greatly appreciated.
PhoneGap is really just a wrapper for html/css/js webpages with a js library for accessing phone specific functionality, which can be compiled to multiple native mobile platform apps.
So this is really not a PhoneGap issue...
You say you are using JQuery to query your web service, if you can open the html file which fires of the request in your normal browser window, and everything works fine. The problem is not with the code, but with the Emulator you are using, maybe some miss configurations idk.
Okay if that still fails, you are most likely pointing to the wrong/no IIS Instance.
If you have two IIS Instances running on port 80 idk how that will behave, but i don't think that will work very well, my guess is that one of them will override the other one.
So if you are hosing your webservice on IIS 1, but IIS 2 overrides IIS 1, then you will never reach the webservice, and get the error you get.
So when you changed to point to the other IIS Instance, it started working again.
I am making a game for Android and using Rails for server coding, and I was wondering how I could get a Rails 3.1 or 3.2 app running somewhere that an android device would have access to from anywhere. I'd like to test the interactions between the two and I am new to any kind of server/web development.
I understand their is localhost, but I am unsure if an Android device can access this.
Being specific as possible would be excellent, thanks guys.
Heroku would be the easiest solution.
http://www.heroku.com/
edit: Since you need filesystem access you'll need to run the app on your own server. Linode is a pretty good choice.
http://library.linode.com/frameworks/ruby-on-rails-nginx/ubuntu-10.10-maverick
http://help.github.com/deploy-with-capistrano/