KhanZeeshan
KhanZeeshan

Reputation: 1410

Android - Create RESTful WebService - Host it on mobile

My question is how to create a web service on android device & host it on the mobile device.

I don't want to access an already created webservice deployed on a server; I want to create a webservice that returns json/xml & host it on mobile.

RESTful Web Services Implementations in Mobile Devices says it's doable for Java-based mobile devices, so I think it can be done for Android too.

Upvotes: 7

Views: 5561

Answers (3)

Franklin Dattein
Franklin Dattein

Reputation: 530

I am trying to solve the same problem and I am leaning towards https://github.com/NanoHttpd/nanohttpd.

It is a tiny webserver without any REST or MVC functionality, thus you would have to write it yourself (MVC, content negotiation, etc).

Upvotes: 0

Husyn
Husyn

Reputation: 9

What you can do is make an Android service which pings a server ( a web-server) every 30 minutes or so simply send a bit from client to server and back to check the availability of request from another phone. This way you can upload media files to server and download them to your another device.

Upvotes: 1

Peter Knego
Peter Knego

Reputation: 80340

There is one problem with your setup and mobile devices: mobile networks (wifi and 3g) mostly use NAT, which prevents inbound connections. This makes mobile devices inaccessible from the internet (inbound) while they can still initiate outbound connections. For this reason mobile devices mostly do not host servers.

Upvotes: 7

Related Questions