本文整理汇总了Java中com.google.assistant.embedded.v1alpha1.EmbeddedAssistantGrpc类的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedAssistantGrpc类的具体用法?Java EmbeddedAssistantGrpc怎么用?Java EmbeddedAssistantGrpc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EmbeddedAssistantGrpc类属于com.google.assistant.embedded.v1alpha1包,在下文中一共展示了EmbeddedAssistantGrpc类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchAccessToken
import com.google.assistant.embedded.v1alpha1.EmbeddedAssistantGrpc; //导入依赖的package包/类
private void fetchAccessToken() {
ManagedChannel channel = ManagedChannelBuilder.forTarget(HOSTNAME).build();
try {
mApi = EmbeddedAssistantGrpc.newStub(channel)
.withCallCredentials(MoreCallCredentials.from(
Credentials_.fromResource(getApplicationContext(), R.raw.credentials)
));
} catch (IOException|JSONException e) {
Log.e(TAG, "error creating assistant service:", e);
}
for (Listener listener : mListeners) {
listener. onCredentioalSuccess();
}
}
示例2: connect
import com.google.assistant.embedded.v1alpha1.EmbeddedAssistantGrpc; //导入依赖的package包/类
/**
* Initializes the Assistant.
*/
public void connect() {
mAssistantThread = new HandlerThread("assistantThread");
mAssistantThread.start();
mAssistantHandler = new Handler(mAssistantThread.getLooper());
ManagedChannel channel = ManagedChannelBuilder.forTarget(ASSISTANT_API_ENDPOINT).build();
mAssistantService = EmbeddedAssistantGrpc.newStub(channel)
.withCallCredentials(MoreCallCredentials.from(mUserCredentials));
}