Android: transfer byte array with AIDL

aidl, android

Solution

Try using byte[] instead of List, it works for me.

interface IMyService {
    int putBytes(String key, in byte[] bytes);
    int getBytes(String key, out byte[] bytes);    
}

AIDL only support primitives, String, CharSequence, List, Map. You can have List but never List

AIDL doc

Problem

I need to transfer byte array between an Android service and client. I have tried to define an aidl interface like: ``` interface IMyService { int putBytes(String key, in List<Byte> bytes); int getBytes(String key, out List<Byte> bytes); } ``` But, it doesn't compile. The error is: ``` [aidl] E:\workspace\RAMService\src\com\connexis\service\mem\IRAMService.aid l:14 parameter bytes (2) unknown type List<Byte> ``` Could someone help me? Thanks in advance!

Original source

Related problems