Pregunta

I need a workaround for the following task: I have a JPG (of whatever) picture on my sd card, and I need to send it to another device in the background. How should I do that? Best way (in theory) would be via MMS, but after a lof of searching, I can say that there is no official and trustful (and working) way to do that in the background.

Any ideas, samples, even proofs that it can be done are welcomed! All that matters is that a remote device must have access to that image.

¿Fue útil?

Solución 3

Maybe I explained badly my needs. An important thing I missed is that the same person has access to both device. I solved it by uploading the image to google drive.

Otros consejos

if you want the sending to happen in background you could use android beam, but you would have to get both devices cloth together.

And as i am not sure about what u mean by background i can't be sure that thats what you want. :)

First of all you need to create a "Service" in App which will run in background and do all tasks given below. A central PHP Server required for this task. Other device can download that file by the same HTTP request method.

  • Convert image to base64 string--

How to convert a image into Base64 string?

you can convert byte array to suitable types- string or delimiter(, or .) separated string

  • Then create a HTTP request--

Make an HTTP request with android

for HTTP request create a url like this - https://www.yoursite.com/post/?code="base64 string goes here"

-Receive data in php file on your server by $_GET global array

$code = $_GET['code']
  • In php file convert base64 code to original image.

How to decode a base64 string (gif) into image in PHP / HTML

get image from base64 string

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top