Can I store image files in firebase using the Java API?

Is there a way to store image files in firebase using the Java api for use in an Android application?

I read this topic. Can I store image files in firebase using the Java API , and there is no answer to this question yet. I know that for him there is an official api called firepano, this is a link https://github.com/firebase/firepano , but this is for the Javascript library.

is there any solution for java library?

+4
source share
1 answer

I used this code and now it works:

  Bitmap bmp =  BitmapFactory.decodeResource(getResources(),
        R.drawable.chicken);//your image
ByteArrayOutputStream bYtE = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, bYtE);
bmp.recycle();
byte[] byteArray = bYtE.toByteArray();
String imageFile = Base64.encodeToString(byteArray, Base64.DEFAULT);     
+13
source

All Articles