Cannot get the exact text spoken in activity using Google Now Voice Search
up vote
0
down vote
favorite
I am integrating google now voice search in one my Android applications. There I initiate google assistance by saying "Ok Google" that will listen for my custom command. Then the assistance will match the spoken text with activity using action:
com.google.android.gms.actions.SEARCH_ACTION
Snippet from my AndroidManifest
:
<activity android:name=".activities.GActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Then in my activity, I check for the action and the text spoken by the user. Like this:
import com.google.android.gms.actions.SearchIntents;
public class GActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_g);
// Get the intent
Intent intent = getIntent();
if (SearchIntents.ACTION_SEARCH.equals(intent.getAction()))
String query = intent.getStringExtra(SearchManager.QUERY);
Toast.makeText(this,
query, Toast.LENGTH_SHORT).show();
Then, from my terminal, I triggered the intent action with the sample text that is about to be spoken(in dev environment, because voice assistance will work only after release) using the following command.
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION
--e query "TextToBeSpoken" my.package.name
I follow this link from android
Support search queries from Google Voice Actions
Use Voice Search to integrate with Google Now
The problem is after I give the command from the terminal, My activity launched successfully, but I can not get the spoken text from the intent object, that is always null.
String query = intent.getStringExtra(SearchManager.QUERY);
Can anyone tell me why the above line returns null? Any workaround for this?
android google-now google-voice-search google-voice-actions
add a comment |
up vote
0
down vote
favorite
I am integrating google now voice search in one my Android applications. There I initiate google assistance by saying "Ok Google" that will listen for my custom command. Then the assistance will match the spoken text with activity using action:
com.google.android.gms.actions.SEARCH_ACTION
Snippet from my AndroidManifest
:
<activity android:name=".activities.GActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Then in my activity, I check for the action and the text spoken by the user. Like this:
import com.google.android.gms.actions.SearchIntents;
public class GActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_g);
// Get the intent
Intent intent = getIntent();
if (SearchIntents.ACTION_SEARCH.equals(intent.getAction()))
String query = intent.getStringExtra(SearchManager.QUERY);
Toast.makeText(this,
query, Toast.LENGTH_SHORT).show();
Then, from my terminal, I triggered the intent action with the sample text that is about to be spoken(in dev environment, because voice assistance will work only after release) using the following command.
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION
--e query "TextToBeSpoken" my.package.name
I follow this link from android
Support search queries from Google Voice Actions
Use Voice Search to integrate with Google Now
The problem is after I give the command from the terminal, My activity launched successfully, but I can not get the spoken text from the intent object, that is always null.
String query = intent.getStringExtra(SearchManager.QUERY);
Can anyone tell me why the above line returns null? Any workaround for this?
android google-now google-voice-search google-voice-actions
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am integrating google now voice search in one my Android applications. There I initiate google assistance by saying "Ok Google" that will listen for my custom command. Then the assistance will match the spoken text with activity using action:
com.google.android.gms.actions.SEARCH_ACTION
Snippet from my AndroidManifest
:
<activity android:name=".activities.GActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Then in my activity, I check for the action and the text spoken by the user. Like this:
import com.google.android.gms.actions.SearchIntents;
public class GActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_g);
// Get the intent
Intent intent = getIntent();
if (SearchIntents.ACTION_SEARCH.equals(intent.getAction()))
String query = intent.getStringExtra(SearchManager.QUERY);
Toast.makeText(this,
query, Toast.LENGTH_SHORT).show();
Then, from my terminal, I triggered the intent action with the sample text that is about to be spoken(in dev environment, because voice assistance will work only after release) using the following command.
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION
--e query "TextToBeSpoken" my.package.name
I follow this link from android
Support search queries from Google Voice Actions
Use Voice Search to integrate with Google Now
The problem is after I give the command from the terminal, My activity launched successfully, but I can not get the spoken text from the intent object, that is always null.
String query = intent.getStringExtra(SearchManager.QUERY);
Can anyone tell me why the above line returns null? Any workaround for this?
android google-now google-voice-search google-voice-actions
I am integrating google now voice search in one my Android applications. There I initiate google assistance by saying "Ok Google" that will listen for my custom command. Then the assistance will match the spoken text with activity using action:
com.google.android.gms.actions.SEARCH_ACTION
Snippet from my AndroidManifest
:
<activity android:name=".activities.GActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Then in my activity, I check for the action and the text spoken by the user. Like this:
import com.google.android.gms.actions.SearchIntents;
public class GActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_g);
// Get the intent
Intent intent = getIntent();
if (SearchIntents.ACTION_SEARCH.equals(intent.getAction()))
String query = intent.getStringExtra(SearchManager.QUERY);
Toast.makeText(this,
query, Toast.LENGTH_SHORT).show();
Then, from my terminal, I triggered the intent action with the sample text that is about to be spoken(in dev environment, because voice assistance will work only after release) using the following command.
adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION
--e query "TextToBeSpoken" my.package.name
I follow this link from android
Support search queries from Google Voice Actions
Use Voice Search to integrate with Google Now
The problem is after I give the command from the terminal, My activity launched successfully, but I can not get the spoken text from the intent object, that is always null.
String query = intent.getStringExtra(SearchManager.QUERY);
Can anyone tell me why the above line returns null? Any workaround for this?
android google-now google-voice-search google-voice-actions
android google-now google-voice-search google-voice-actions
edited 18 hours ago
André Sousa
720416
720416
asked 19 hours ago
Anbarasu Chinna
474217
474217
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224121%2fcannot-get-the-exact-text-spoken-in-activity-using-google-now-voice-search%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password