send image data from android device to web-server - android

I'm developing a server-client web based application. Clients are mobile phones (android) which should send their data to the server. Their data includes (among other things) images which may be up to 1MB in size. What is the best way for sending these images to the server? A web service? FTP? or something else? Provided we have fast and stable mobile internet connection, can we safely use web service? I can imagine that android device sends image data as raw binary to the webservice and webservice writes these data into database, then website can use these data to display images. Is it a good idea to use webservice for this scenario (specially for large images being up to 1MB in size)? or I should other methods?

Related

asp.net Web Api and mobile aplications

I just want to make a TV guide for Android and later some other Mobile Platform. I want to use an RSS updates to update my application. In this specific scenario I want to use http://tvprofil.net/ 's RSS resource. I thought that I could just call site's RSS XML from my Android app, parse it, show, and thats the end of the story.
But, my cousine told me that the best way to do things is through Asp.net Web Api Service. Something to deal with REST. So, If I have to change resource, to like some iptv provider's RSS I would just change the Service and not have to deal anything with my mobile application. Other advantage, he said, is if I want to build Windows Phone application or iOS aplication that works the same way, I would have that same service to do job for me and just create UI and basic things for those apps.
The problem is that I have no idea how Asp.net web Api is used.
Can anyone give me some usefull link, or even better, write an example of this thig. I just want the RSS from http://tvprofil.net/ to go through Asp.Net Web Api Service and that I can call service and get it as XML or ... even Json... or to get anything at all to my app.
The whole thing is pretty confusing to me
If a RSS feed has enough data for your application to function then you do not need ASP.NET Web Api. The only role ASP.NET Web Api could play in this scenario is if it acted as an intermediate. E.g. your client application contacts your server application (ASP.NET Web Api) which in turn pulls the data from the actual external data source (tvprofil.net RSS).
For completeness sake, a list of pro's and con's:
Advantages of using an intermediate server
Reliability. You can cache the data of the external data source and serve that data even while the external data source is offline. Also, by caching the data you can lighten the load on the external data source to a bare minimum.
Transformability. Your intermediate server can translate the data of an external data source to another format that is more suitable for your client application. This is useful when you have many external data sources that each serve data in another format. Your intermediate server acts as a layer of abstraction for your client application.
Disadvantages of using an intermediate server
More effort. It will take more effort to develop and host an intermediate server.
Reliability. You must ensure your intermediate server is online and connected to the internet 24/7

Accessing database or webservice

I want to access an online MySQL database in order to retrieve and manipulate data. I read that the best way would be implementing an own web-service, which returns XML and then parse it in Android, is it right?
Does anybody have a basic tutorial?
Since you want to access a remote server which has your DB and other stuff.
You basically have two options.
1 - ) Either directly access your server via sockets etc.
2 - ) Or create a web service which will connect your server to the outside. ( I.e : Android Client,iOs client etc.)
The best practice is to create a web service and then consume it in your Android application.
Check these for consuming XML in Android.
http://www.ibm.com/developerworks/opensource/library/x-android/
http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/
Check these for creating web services on server side. (Stack independent)
http://davidwalsh.name/web-service-php-mysql-xml-json (PHP)
http://www.roseindia.net/webservices/buildingsimplewebservice.shtml (Java)
http://www.codeguru.com/csharp/csharp/cs_webservices/article.php/c19391/Creating-a-NET-Web-Service.htm (.NET)
And so on there are a lot of stacks to create web services.
Again, Webservice is the best approach. But you have to take decision based on the amount of the data being retrieved from the server and how often the transaction needs to be synchnorized with the server.
What Arvind was trying to explain you, incase if the volume of data is too large to download via webservice then you probably need to think of some middle tier that will convert he data to json and send it to your device. The reason, if you are transmitting the 1k of soap response over the air, for the same response, if you are transmitting thro json, it could be 100k or 200k or 300k depends. That way you can save the transmission cost over the net and turnaround time is quicker .

Fastest Way to send Data from Android to Server?

I want to send image and text data from Android phone to a Server. i am new plz suggest me the best and easy way to do this task. Server is running a java web service and i will be getting the data from server and also sending the data to server. Thanks
As your server is already there, you will have to use protocol it can uderstand - also SOAP, REST or whatever it uses. So no choice for you.
If you are deigning client-server interacton with android application, you may consider network socket communuication which has less overhead as webservices.

Send images from server to android app

I have an Android app that fetches data from the web service using ksoap2, the web service in turn fetches that information from SQL Server and sends it to the app, ksoap2 is fast and reliable and I'm happy with it.
I'm about to add a new feature which is the app will fetch multiple images from the server too. I searched for the best way to do this and I landed on three options:
keep using ksoap2 and store the images on the SQL Server, the web service will send the images in binary strings and then the app with render them and display them.
Store the images on the hard drive and use HttpUrlConnection, the web service will send the images path (url) through ksoap2 and the app will use HttpUrlConnection to download the images and display them.
Use JSon
My question is, from your experience which way should I go for? or maybe you have a better solution than that?
Thanks.
I would use option #2:
Store the images on the hard drive and use HttpUrlConnection, the web service will send the images path (url) through ksoap2 and the app will use HttpUrlConnection to download the images and display them.
This gives you the benefits of ksoap2, without a hacky workaround trying to jam images into SQL binary strings.
Additionally (and this is without knowing anything about the app you are creating) it allows you to only load the images when you actually need them, saving bandwidth, battery and memory.

Efficient way of sending data to web service

I have web Service on .net . And i use to upload data to this web service at regular interval of time . My data contains mostly string and some byte[] of Image (Around 8 of them). It takes around 4-5 mins to upload .
Now my problem is while sending data via GPRS (Android Mobile ) and it take lot of time to upload data (sometime connection time out also occurs), Can any one tell me how to improve upload time .
I am using KSOAP2 for sending data .
There are some possible techniques for reducing the data to be transfered - however all of them require special server features or if not supported changes on server side:
The simplest way would be to use HTTP transport compression but that is a feature that has to be supported by the server.
An alternative that reduces the XML overhead would be to switch to WBXML (binary encoded xml - once developed for "WAP") but AFAIK KSoap does not support it (and most web-service servers, too)

Categories

Resources