开发者

Sharing sound resource with service

开发者 https://www.devze.com 2023-03-16 23:06 出处:网络
I have some activities and one service. I want to share a sound resource file (in the activities\' res/raw folder primarily, but possibly in assets/) with the service. The activities and the service a

I have some activities and one service. I want to share a sound resource file (in the activities' res/raw folder primarily, but possibly in assets/) with the service. The activities and the service are in different APKs, signed with different keys.

One way is to read the file into memory,开发者_StackOverflow中文版 but I'd like to avoid that.

Is there perhaps an option of sharing "file handles" with a service?

Any pointers for how to achieve this?

Thanks in advance,

Jonas


Went with ContentResolver.openAssetFileDescriptor() on the service in the end. Should be possible to send an AssetFileDescriptor over IPC but didn't manage to.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号