Getting Android App Icons back from Plugin

Godot Version

4.2.2

Question

How would I go about getting an apps icon from an android plugin into Godot? What’s the process for returning a Drawable?

I’m building a launcher, and ao far I’ve been able to successfully get a list of all packages, then a list of filtered packages (the installed applications that launch the activities), and im able to launch the applications.

However I’m struggling to get the app icons back from the android plugin.

I’ve tried returning them as a ByteArray, which is a listed return type on the Godot documentation (listed as byte), but this is ALWAYS null for some reason when it reaches godot. I’ve even tried converting it to a string first (which does return text), but I’m struggling with reconverting it back into an image after this (if this is even possible, I’m honestly not sure)

Any help on this matter would really be appreciative

Are we allowed to bump in this forum? If so, bump, if not, im sorry.

Oh! I actually solved a problem, and it came down to my general lack of knowledge. I didn’t know you could convert images to strings, and even then I was stuck in a UTF8 string until i learned about how people send string encoded images across network.

You need to encode the image as a base64 string, which both Kotlin and Java can do. Then, in godot you need to use load_png_from_buffer(Marshalls.base64_to_raw()), and just create an image texture from that like you would normally.

HOWEVER, I was digging around in the godot source code for the android plugin and I think I found an issue with bytearray not properly being converted to PackedByteArray, so I’m probably going to make an issue in github about it. Not sure if I’m just misreading it or if I’m on to something. ByteArray is still just always empty, even in C#.