0

First of fall sorry for my weak english i want to open my app by "Ok google" with search query. But not Open my app With "Ok Google". I get stuck in it. So suggest me where i wrong

But Open My App When I try to say open in "Ok Google" with "Open App Name" that time open my app

So please help me thanks for advance

Following my code in AndroidManifest.xml

 <intent-filter>
 <action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
 <category android:name="android.intent.category.DEFAULT" />
 </intent-filter>  

And In Java File

 String query = "";
 if (getIntent().getAction() != null &&
          getIntent().getAction().equals("com.google.android.gms.actions.SEARCH_ACTION) {
 query = getIntent().getStringExtra(SearchManager.QUERY);

}
Rahul
  • 1
  • 3
  • Check this - [Receive search from Google Now](https://stackoverflow.com/a/26718384/6244429) – Vishal Yadav Jun 30 '17 at 06:57
  • Tx for Your Valuable Response But This is not working i have performed all my side – Rahul Jun 30 '17 at 09:24
  • Doe's i need to publish app in the store? – Rahul Jun 30 '17 at 09:28
  • publish app - bro i am not sure – Vishal Yadav Jun 30 '17 at 10:32
  • Ohk bro no problem – Rahul Jun 30 '17 at 11:13
  • Following code is working some devices but not work all devices. so what can do work for all devices? ' if (Intent.ACTION_SEARCH.equals(intent.getAction()) || "com.google.android.gms.actions.SEARCH_ACTION".equals(intent.getAction())) { query = intent.getStringExtra(SearchManager.QUERY); Log.d(TAG,"Data---->" + query); getDataFromUser(query);' – Rahul Jul 03 '17 at 06:34
  • @Rahul you do not need to publish the app for voice commands to work source: https://stackoverflow.com/a/26718384/1441732 – Swapnil Kadam Mar 06 '20 at 06:13

0 Answers0