2017-10-19 4 views
-1

효율성을 높이기 위해 스크립트를 통해 Android 앱에서 자주 사용하는 명령을 Google Assistant에 보내고 싶습니다. 예 : 나는이 topic을 발견Android 앱에서 Google Assistant에 명령 보내기

startActivity(new Intent(Intent.ACTION_VOICE_COMMAND).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); 

,이 라즈베리 파이 가능 아니라고 말한다 구글 도우미 SDK를 사용합니다. "좋아, 이건 내가 서비스에서 도우미를 호출하기 위해 사용하는 코드 구글

입니다 . 그것은 안드로이드 애플 리케이션에 대해 동일

답변

1

가 작동하도록 관리 :

String command = "navigate home by public transport"; 
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); 
intent.setClassName("com.google.android.googlequicksearchbox", "com.google.android.googlequicksearchbox.SearchActivity"); 
intent.putExtra("query", command); 
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //necessary if launching from Service 
context.startActivity(intent); 

출처 : StackOverflow question