15 #include <android/log.h>
18 #include "examples/protos/helloworld.grpc.pb.h"
19 #include "examples/protos/helloworld.pb.h"
24 extern "C" JNIEXPORT jstring JNICALL
26 JNIEnv*
env, jobject , jobject application) {
29 setenv(
"GRPC_VERBOSITY",
"INFO",
true);
30 if (grpc::experimental::InitializeBinderChannelJavaClass(
env)) {
31 __android_log_print(ANDROID_LOG_INFO,
"DemoClient",
32 "InitializeBinderChannelJavaClass succeed");
34 __android_log_print(ANDROID_LOG_INFO,
"DemoClient",
35 "InitializeBinderChannelJavaClass failed");
37 static bool first =
true;
38 static std::shared_ptr<grpc::Channel>
channel;
48 ch_args.
SetString(
"grpc.binder.custom_android_intent_action_name",
49 "grpc.io.action.BIND");
50 channel = grpc::experimental::CreateCustomBinderChannel(
51 env, application,
"io.grpc.binder.cpp.exampleserver",
52 "io.grpc.binder.cpp.exampleserver.ExportedEndpointService",
54 grpc::experimental::binder::SameSignatureSecurityPolicy>(
57 return env->NewStringUTF(
"Clicked 1 time, channel created");
63 request.set_name(
"BinderTransportClient");
66 return env->NewStringUTF(
response.message().c_str());
68 return env->NewStringUTF(
69 std::string(
"Clicked more than 1 time. Status not ok " +