简体   繁体   English

谷歌助手是否可以在 Android 上的某个应用程序中按下按钮?

[英]Is it possible for google assistant to press a button in a certain app on Android?

I'm new to Android programming.我是 Android 编程的新手。 I just created a simple program with a couple of buttons.我刚刚创建了一个带有几个按钮的简单程序。 Each button does something unique.每个按钮都有独特的作用。 Pushing Button 1 prints out "First Button" and button 2 prints out "Second Button" in a new view.按下按钮 1 打印出“第一个按钮”,按钮 2 在新视图中打印出“第二个按钮”。

I want to ask Google assistant to press button 1 in my app.我想让 Google 助理在我的应用程序中按下按钮 1。 I want my app to open (if it's not already open) and show the message "First Button".我希望我的应用程序打开(如果它尚未打开)并显示消息“第一个按钮”。 I want it to do the same with the button 2 basically showing "Second Button" when I ask it.当我问它时,我希望它对基本上显示“第二个按钮”的按钮 2 做同样的事情。

I'm using Java in Android Studio.我在 Android Studio 中使用 Java。 I researched a few things to try and find an answer and came across "DialogFlow" and "Actions SDK".我研究了一些东西以尝试找到答案,并遇到了“DialogFlow”和“Actions SDK”。 I also read about deep links but I'm not really seeing exactly what I'm looking for.我还阅读了有关深度链接的信息,但我并没有真正看到我在寻找什么。 They seem more for people that are trying to sell stuff on their website to get the user to the page they want.对于那些试图在他们的网站上出售东西以让用户访问他们想要的页面的人来说,它们似乎更多。 I got it to open up the app but how do I emulate a button press?我得到它来打开应用程序,但我如何模拟按钮按下?

Thank you in advance!先感谢您!

Maybe you should look at these links - https://developers.google.com/assistant/app/ and https://developer.android.com/guide/slices .也许你应该看看这些链接 - https://developers.google.com/assistant/app/https://developer.android.com/guide/slice If you google assistant to trigger a button action or go to a particular screen.如果你用谷歌助手触发按钮动作或 go 到特定屏幕。 Deep-link or App link is a way to navigate to any part of the app based on the click event on the hyperlink.深层链接或应用程序链接是一种基于超链接上的点击事件导航到应用程序任何部分的方法。 I had previous research on similar idea.我以前对类似的想法进行过研究。 Those links should give you an idea.这些链接应该给你一个想法。

Try to look at this: Custom intents .试着看看这个:自定义意图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM