Reputation: 639
I need to develop a web service based application in ASP .Net which will be consumed from various platforms (.Net and Android most notably). One method needs to accept images and store them in the server. If the app would be used solely from .Net, the method would have the following signature:
void AddImage(Image img);
However, since obviously Android and Java will not be aware of the Image class, what method should I choose in this case? Is it better to pass the image as a byte array or should I use other means?
Upvotes: 0
Views: 192
Reputation: 1544
In android you can convert that image into base 64 String and then can pass to the webservice,
String encodedImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
In that case your method will look like
void AddImage(String img);
Upvotes: 2