Sending bytes [] of data to an action without creating a file

I developed an Android application that takes a snapshot, calls web services and sends both documents (image and web service response) with the intent ACTION_SEND_MULTIPLE . This action requires data to be transmitted as an ArrayList<? extends Parcelable> ArrayList<? extends Parcelable> ; Therefore, the application stores data in temporary files and creates two Uri objects from them. The main drawback is that the application cannot delete these temporary files, since it is impossible to determine if the called activity was processing data.

Is it possible to send data ( byte[] data type) using ACTION_SEND or ACTION_SEND_MULTIPLE without creating temporary files?

thanks

+4
source share
1 answer

sure! if you have data in bytes [], you can do it like this.

 Intent i = new Intent(Intent.ACTION_SEND) ; i.setType("your mime type here"); i.putExtra(Intent.EXTRA_STREAM, data); startActivity(Intent.createChooser(i,"Send this To:")); 
+1
source

All Articles