Android web server annotations - android

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

Related

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.

Setting up a server for iOS/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

Using Azure to develop website then create native iOS and Android app for it later, what would be good data architecture?

I have built a blog using Windows Azure and .NET MVC.
This was my only experience for web development, so I am still pretty new in this area.
I just got an idea for my second website and I plan to develop native iOS/Android/windows app for it later on.
I am going to use Windows Azure SQL database and .NET MVC again for this, but I wonder if this is good choice for my future development for mobile app as well. Can my mobile app easily get access to data hosted in Azure SQL? If so could you let me know in which way? any suggestion is welcome, thanks!
A service-oriented architecture decouples the back end from how it is displayed.
You can use SOAP or REST services to fulfill each use case.
Come up with a protocol/contract that the services expose and any client that can make HTTP requests can work with them.
Take a look at Windows Azure Mobile Services (http://www.windowsazure.com/mobile). Mobile Services is a backend as a service you can use for your data storage from your asp.net site (from the C# code behind) and then when you're ready to build your mobile apps, you can use the exact same interfaces from the native Objective-C iOS / Java Android / .NET Windows SDKs. This will save you from needing to write the service layer if you don't want to spend time doing that.
Since your comfortable with ASP.NET MVC, I would recommend you build the website in MVC, but then have it call into a service layer that exposes the functions desired using ASP.NET Web API.
This would be an easy fit as you can then build your native mobile app later, and just call the API using JSON as the data format.
Great question by the way!

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.

Android reusing GWT RPC backend without AppEngine

I have been developing GWT application for a while and I'm trying to port my app to Android. I'm very new to Android but it seems that the ADT share many similarities with GWT so the learning curve might not be very steep.
There's what I read from GPE 2.4
Android and GWT clients that are capable of talking to the same App
Engine backend using the same RPC code and business logic.
It would be great to share the same backend which I spent a hell lot of effort in design and implementation. However, I'm not using AppEngine and impossible to switch to it either. I'm wondering if the Android app can still share the same RPC structure with GWT without using AppEngine. Thanks.
If you're still in need of a solution, check out GWT-SyncProxy (Disclaimer, I recently joined the project). I just put out a 0.4 release that has an Android Library that allows you to make GWT RPC calls from Android (or Java standalone apps using the regular library).
https://code.google.com/p/gwt-syncproxy/.
The library can utilize Android accounts if you do switch to GAE, but it's definitely not required.
You can try to use http-dispatch. It is the adapted gwt-dispatch framework which can be used on Android platform. Http-dispatch uses default binary serialization so it works from the box for many types of objects. Currently it is in alpha but you can try http://code.google.com/p/http-dispatch/

Categories

Resources