Setting up a server for iOS/Android - android

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

Related

Android web server annotations

We are looking to add a restful web server to our embedded android application (Not an app, an appliance running Android). Is it possible to use Spring or another java web server annotation framework in an android app?
Qoute "MiniWeb is a Http server library written in Java targeted for embedded projects. MiniWeb's goals are to be small and lightweight as possible while providing simple and easy to use API. MiniWeb uses the very mature and robust Apache HttpComponents at its core. MiniWeb only supports what is necessary to get an embedded web project up and running quickly (no servlets)."
https://github.com/dinocore1/MiniWeb
Good luck

How to create Android Web UI - remote app management

I have an application that runs on Android phone. I would like to add web ui like let's say torrent applications. I would like to manage my application from browser using my laptop, or another phone located on a different side of the planet ;)
What is the easiest way to run a web server inside app, and host a management web app? Is it possible to run nodejs/php server inside application and communicate with hosted web app?
Should be possible, because ttorrent and x-plore have such feature.
Thanks for any clues and advices.
I did several in-app web server projects. nanohttpd and golang are used in my projects.
Nanohttpd is wrote in pure Android SDK compatible Java. You can call any Android SDK API, with no need of RPC or language binding. But nanohttpd has little supports to develop web API. It's not a good choice if you have lots of APIs between javascript and the in-app server, but good if you need invoke Android SDK APIs in the in-app server.
golang supports Android(ARM Linux) well. The good parts are:
static link. you just need coding and build, everything will in one shared library file, you can ease use the library in your Android project
powerful APIs in standard library to develop a web server and web client. Great performance because of golang's async I/O and thread model
gomobile provide a tool to generate RPC wrapper for golang-java inter-operation. golang-c(jni)-java wrapper will also work but I not found a tool to generate the binding, writing bindings is boring.

WebRTC using Peerjs with Native Android/iOS clients

We're trying to build an internal system which will provide us with simple chat/video features using WebRTC. We have successfully deployed Peer.js client and server which works great over the browser.
However, we can't seem to find a fairly simple Android/iOS client/SDK to make it compatible with our PeerJS server.
We've tried looking into AppRTC and got the Android client running with their server, however we can't understand how to connect it to our PeerJS server since that Android client (and server implementation) seems really complicated (we're not JAVA experts).
I've also looked into EasyRTC, however it seems that they've pulled back their native SDKs, but the technology stack looks really close to ours.
My question is, has anyone got and Android/iOS Client working with WebRTC running on a NodeJS server? What are the possible workarounds to get this up and running natively on Android?
We're looking for a fairly simple Android SDK (links to libraries/sample projects) which could work with a PeerJS server.
Edit: We could build a signaling server (on NodeJS) ourselves, but how can we build the Android/iOS clients from then on?
I'm offering a bounty of 200 rep to whoever can answer our questions.
I don't know PeerJS but it seems like using websockets. If that's the case you have to implement WebSocket client functionality in you native clients (and various PeerJS internal connection/signaling protocol).
For native to native signaling, it's really simple because we only have to exchange SDP and ICE candidate messages between clients (via WebSocket or any other messaging mechanisms).
To connect to PeerJS server, obviously, we need PeerJS client implemented in Java or C(ObjC).
I'll be surprised if such implementation or SDK exists.
I don't know current state of AppRTC source, but in its old version, it hosted a WebView to run a kind of HTML+JavaScript signaling client.
That is, you can host a WebView and reuse your PeerJS client in Android/iOS apps.
You can have look at Crosswalk project. By follow Tutorial: porting Android app from Web App for WebRTC using PeerJS library. I have done it and it worked perfectly.
There are another option which is using http://phonegap.com/ to port from web app to Android/iOS but I could not make it work event just with "getUserMedia" API.
Hope this help
I found a example in here https://github.com/pchab/AndroidRTC1
On the server they used nodejs + socket.io + AngurlarJs.
On the client they used libjingle_peerconnection + socket.io Client.

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.

Can we use Tomcat Server in android app

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.

Categories

Resources