0
votes

IS there any approach allows the android service only accept the binding from specific components (NOT APP) which could be the components of partner's APP or in-house APP.

Using permission doesn't satisfy my situation, because any APP declared using this permission will be able to bind my service. What I want to do is opposite that it's me who chooses which components can bind with my service.

if you are using AIDL then override Stub#onTransact and do your checks there - pskink
AIDL. I'm checking with onTransact now. It seems good for me - Tianhao SHI
Stub#onTransact is good. My final solution is using Binder#getCallingUid in this function to identifier the caller. Thanks - Tianhao SHI