How to create Android Web UI - remote app management - android

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.

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

Communicating to the restful web services in Phonegap

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:-)

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!

Maximal reuse: Webservice, Android client, Web Client, how?

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?

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.

Categories

Resources