How to transfer images from Android client to Java server - java

I am trying to developer an Android application which allows to capture pictures with the camera, and send the pictures to a Java server.
I don't need the picture after, so I do not need to store it in the phone locally.
I was able to successfully to transfer simple text from client to server, but I'm having problems with images.
What do I need to do to be able to send images from the Android client, and should anything special be made in the server apart from what it is doing now?

Solution is to use http request with MultipartEntity.

Related

how can I connect my image processing application in my android application

I have image processing application written in python consists of CRNN model, and I want to take an image from my android application and send it to the image processing and receive back a response from it.
what should I use to make it done.
I would create a server that deals with the logic (in python) and make the app communicate with it over HTTP requests.
The app would send the image to the server, the server would process it, and then send the output to the app.

Host database using Android phone

Here is the current scenario:
I have two(2) Android phones.
Android Phone 1 as the server phone.
Android Phone 2 as the client phone.
Here is what I want to do:
I want to create an Android-based app (E.g. Student Information app) where it will have basically two (2) modes:
Server - for adding, editing and deleting data on a local database.
Client - for viewing data from the database of the server.
The app will be installed to Android Phone 1 and set to Server mode.
The app will be installed to Android Phone 2 and set to Client mode.
I want to ask these questions:
I want to locally host the database of the Server app, so that Client app will be able to view the data. Is this possible?
If yes, how can I do it?
Note:
I am currently a web developer so I know that connected on the same network is a requirement.
I have implemented the same concept on a medium business where the web-based system is locally hosted so that computers on the same network can access it.
Suggest everything that you want to suggest, except the disadvantage of doing this concept. I am aware of some obvious disadvantages based from my research and willing to face the disadvantages provided that I will be able to implement the concept.
Rooting the phones is an option.
I want to accommodate small-sized business that is why I want to use Android phones rather than using Desktop Computers/Laptop.
I have read similar suggested questions here based on my title.
We have done the exact same thing in my company. The way we solved this is that the server exposes a service using the Android NSD API, so the clients (using the same API) can find it on the network. And after a client has connected to the server, the server sends its database file (yes, the .db file in /data/data/...) to the client via OutputStream. When the client receives the entire database and checks for its integrity, it copies it to its own /data/data/... and restarts part of the app.
Android NSD

Is it secure to build android app that works with PHP API on browser?

I'm learning to build android apps using java & android studio.
For my app i need internet connection and a server side database, I'm already php developer so i tought to build a PHP web API and by json, send and recieve data from specific URL.
For example, any user that will register inside my app, i can send his data to:
(via POST or GET method.)
example.com/api/user_register.php
Is it secure? How can i get data and send to an existing domain in java?
I'm looking for something similliar to file_get_content() or CURL in PHP.
Also i need to build something like push notifications..
Creating an web API to access a MySQL Database for Android is expected as there is no direct connection to the database possible on Android.
I've done something similar with one of my own apps. How secure it is depends on how you make it and where your PHP API is. I.e. is the data being sent to/from HTTP or HTTPS. In my own app, I encrypt the post data on the device, post it to my PHP API which decrypts and processes the request.
It then builds a response and json_encodes it, which is then encrypted and sent back to the device, where the device decrypts it and processes the JSON result. All of this is also done over HTTPS so hopefully, its fairly secure.

Redirect Restful directly to Couchbase to reduce encoding decoding

Could any one of you suggest what would be the proper solution to this design.
Here is what I'm trying to accomplish and I'm not sure whether it's all possible.
Infrastructure
Android > Php ZF > Couchbase
So all communication is done using Restful. Currently how it works in my apps is as follow. Android requesting an image file say jpg/png to my apps via Restful. Myapps needs image file stored in the Couchbase so it contacted Couchbase via Restful, received file in apps server, decode the restful from base64 back to jpg/png , Encode the data again to base64/Json, transfer it to Android device. Android device received the Json in base64, decode it back to the jpg/png.
Does this movement make sense?
So in order to cut down on decoding>encoding>decoding. I'm wondering whether it's possible for me to have my android contact the Couchbase directly via my PhpZF apps server and just do decoding once after it arrived at the android device?
Please advise? Many thanks everyone. Hope this make sense on what I'm asking for?

How to load Images from Java Server+MySql to Android Client

I've a social networking app for android in which i can view list friends after fetching from java server +mySql database, actually i have done with loading all information from Java Servlets to android client but i'm unable to load images which are stored as blob in mysql on the server side database.
I tried to send blob objects to android client as strings and then tried to convert them in bitmap at the android client side. but I could not do what i wanted.. :(
Can anyone suggest me how to do it?
I think a viable solution is to put a simple blob servlet capable to send a image/your_image_format response via HTTP. This way you can easily download/decode the Bitmap in your Android client from the servlet response, then set it as your ImageVIew source.

Categories