I would like to use routeAPI - gRPC on Android. But in none of the documents, I can't find how to define the message in the proto file.
What I looked for as much as I could is this document.
Is there a way for me to implement route API pathfind on android with gRPC? or googleMap gRPC android Example?
Thank you.
I want to use gRPC in android
I'm going to answer your question literally (I'm not familiar with the Maps API and so unable to comment on other ways that this may be done).
Google publishes all (most!?) of its gRPC services in a public GitHub repo called
googleapis.Google's gRPCs are namespaced
googleand are then namespaced by service e.g.mapsand, in your casegoogle/maps/routing/v2contains multiple protos but the one of primary interest isroutes_service.protoand specifically line 87 which definesComputeRouteswhich, I think is what you're after!?Now (!) generally (!?) Google publishes SDKs that implement the gRPC stubs for these services. Please ensure that the SDK doesn't already exist as it will save you time.
However, because gRPC defines the services (
rpc's andmethod's), we can generate the stubs for ourselves:If you clone
googleapis, the protocol bufferproto_path(import path) should be this repo's root folder and you can generate the services inroutes_service.protousing the fully-qualified pathgoogle/maps/routing/v2/routes_service.protoroutes_service.protohas a slew of imports but these are a combination of:googleapis;