src/android/aidl/example-service/client.md
Finally, we can create a Rust client for our new service.
birthday_service/src/client.rs:
# // Copyright 2024 Google LLC
# // SPDX-License-Identifier: Apache-2.0
#
use com_example_birthdayservice::aidl::com::example::birthdayservice::IBirthdayService::IBirthdayService;
use com_example_birthdayservice::binder;
{{#include ../birthday_service/src/client.rs:main}}
}
birthday_service/Android.bp:
{{#include ../birthday_service/Android.bp:birthday_client}}
Notice that the client does not depend on libbirthdayservice.
Build, push, and run the client on your device:
{{#include ../../build_all.sh:birthday_client}}
Happy Birthday Charlie, congratulations with the 60 years!
Strong<dyn IBirthdayService> is the trait object representing the service
that the client has connected to.
Strong is a custom smart pointer type for Binder. It handles both an
in-process ref count for the service trait object, and the global Binder ref
count that tracks how many processes have a reference to the object.