5

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!

Dagang
  • 24,586
  • 26
  • 88
  • 133

2 Answers2

9

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

zhao chang
  • 211
  • 3
  • 8
0

Try something like its described here: Transfering ByteArray through Parcel returns NullPointerException

This is example of how to transfer byte array by wrapping it in Parcelable interface. I think you can do the same with List

Community
  • 1
  • 1
krossovochkin
  • 12,030
  • 7
  • 31
  • 54