josesamuel / remoter

Remoter - An alternative to Android AIDL for Android Remote IPC services using plain java interfaces
Apache License 2.0
84 stars 14 forks source link

is It possible user Remoter service in bindDeviceAdminServiceAsUser of the DevicePolicyManager? #13

Closed franklinwesley closed 1 year ago

franklinwesley commented 2 years ago

Hi, my solution uses multiples users on android and I have an AIDL server running on the owner user where the other users access it, I found this library and it would be perfect for new architecture that I'm implementing, but to access a service on another user is necessary bindAdminDeviceServiceAsUser, is it possible to ultiliza somehow? Or have any other suggestions?

josesamuel commented 2 years ago

How is this different than any other service connection? Isn't the service part still the same?

franklinwesley commented 2 years ago

Sorry the delay, answering your question, the bind is done internally by android and returns the service object by the provided callback. I need to inject this object into the viewmodel

Documentation: https://developer.android.com/reference/android/app/admin/DevicePolicyManager#bindDeviceAdminServiceAsUser(android.content.ComponentName,%20android.content.Intent,%20android.content.ServiceConnection,%20int,%20android.os.UserHandle)

josesamuel commented 2 years ago

How is this different than bindService? When the service gets connected, you will get a call back in ServiceConnection that you passed to it.. From that onServiceConnected callback you get the IBinder. Use that to create the Proxy

franklinwesley commented 2 years ago

Thanks, it worked for me passing the iBinder to the proxy, I needed adjustments in my solution but your lib adapts perfectly to the new architecture, thank you very much