How to get user input values from Intent when using Google assistance to interact with my app?
up vote
0
down vote
favorite
Hey I am using ACTION_CREATE_NOTE and SEARCH_ACTION in my app to create a note and search for a note by text in my app.
The search action is working fine as I am getting the search query <My query>
when I speak the following in google assistance "Search for <My query> in <My app>"
.
Problem is with ACTION_CREATE_NOTE as I am not getting the note text or title or text query, all are null. Can anyone please help.
Here is what I did.
Manifest entry:
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.actions.CREATE_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
Activity code:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
val action = intent?.action
if (NoteIntents.ACTION_CREATE_NOTE == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.CREATE_NOTE -n <yourPackageName>/.MainActivity
val name = intent.getStringExtra(NoteIntents.EXTRA_NAME)
val text = intent.getStringExtra(NoteIntents.EXTRA_TEXT)
val query = intent.getStringExtra(NoteIntents.EXTRA_NOTE_QUERY)
Toast.makeText(this, "$name $text $query", Toast.LENGTH_LONG).show()
}
if (Intent.ACTION_WEB_SEARCH == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "Search for something" <yourPackageName>
val query = intent.getStringExtra(SearchManager.QUERY)
Toast.makeText(this, "Query: $query", Toast.LENGTH_LONG).show()
}
}
For Search (which is working)
INPUT: Say following to google assistance: "Search for nearby stations in my app"
OUTPUT: Toast message - "Query: nearby stations"
For Create a note (not working)
INPUT: Say following to google assistance: "take a note to remind me to get milk"
OUTPUT: Toast message - "null null null"
NOTE: App is uploaded on internal release on play store that is why search is working. Otherwise, the search will also not work.
Thanks in advance.
android
add a comment |
up vote
0
down vote
favorite
Hey I am using ACTION_CREATE_NOTE and SEARCH_ACTION in my app to create a note and search for a note by text in my app.
The search action is working fine as I am getting the search query <My query>
when I speak the following in google assistance "Search for <My query> in <My app>"
.
Problem is with ACTION_CREATE_NOTE as I am not getting the note text or title or text query, all are null. Can anyone please help.
Here is what I did.
Manifest entry:
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.actions.CREATE_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
Activity code:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
val action = intent?.action
if (NoteIntents.ACTION_CREATE_NOTE == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.CREATE_NOTE -n <yourPackageName>/.MainActivity
val name = intent.getStringExtra(NoteIntents.EXTRA_NAME)
val text = intent.getStringExtra(NoteIntents.EXTRA_TEXT)
val query = intent.getStringExtra(NoteIntents.EXTRA_NOTE_QUERY)
Toast.makeText(this, "$name $text $query", Toast.LENGTH_LONG).show()
}
if (Intent.ACTION_WEB_SEARCH == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "Search for something" <yourPackageName>
val query = intent.getStringExtra(SearchManager.QUERY)
Toast.makeText(this, "Query: $query", Toast.LENGTH_LONG).show()
}
}
For Search (which is working)
INPUT: Say following to google assistance: "Search for nearby stations in my app"
OUTPUT: Toast message - "Query: nearby stations"
For Create a note (not working)
INPUT: Say following to google assistance: "take a note to remind me to get milk"
OUTPUT: Toast message - "null null null"
NOTE: App is uploaded on internal release on play store that is why search is working. Otherwise, the search will also not work.
Thanks in advance.
android
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Hey I am using ACTION_CREATE_NOTE and SEARCH_ACTION in my app to create a note and search for a note by text in my app.
The search action is working fine as I am getting the search query <My query>
when I speak the following in google assistance "Search for <My query> in <My app>"
.
Problem is with ACTION_CREATE_NOTE as I am not getting the note text or title or text query, all are null. Can anyone please help.
Here is what I did.
Manifest entry:
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.actions.CREATE_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
Activity code:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
val action = intent?.action
if (NoteIntents.ACTION_CREATE_NOTE == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.CREATE_NOTE -n <yourPackageName>/.MainActivity
val name = intent.getStringExtra(NoteIntents.EXTRA_NAME)
val text = intent.getStringExtra(NoteIntents.EXTRA_TEXT)
val query = intent.getStringExtra(NoteIntents.EXTRA_NOTE_QUERY)
Toast.makeText(this, "$name $text $query", Toast.LENGTH_LONG).show()
}
if (Intent.ACTION_WEB_SEARCH == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "Search for something" <yourPackageName>
val query = intent.getStringExtra(SearchManager.QUERY)
Toast.makeText(this, "Query: $query", Toast.LENGTH_LONG).show()
}
}
For Search (which is working)
INPUT: Say following to google assistance: "Search for nearby stations in my app"
OUTPUT: Toast message - "Query: nearby stations"
For Create a note (not working)
INPUT: Say following to google assistance: "take a note to remind me to get milk"
OUTPUT: Toast message - "null null null"
NOTE: App is uploaded on internal release on play store that is why search is working. Otherwise, the search will also not work.
Thanks in advance.
android
Hey I am using ACTION_CREATE_NOTE and SEARCH_ACTION in my app to create a note and search for a note by text in my app.
The search action is working fine as I am getting the search query <My query>
when I speak the following in google assistance "Search for <My query> in <My app>"
.
Problem is with ACTION_CREATE_NOTE as I am not getting the note text or title or text query, all are null. Can anyone please help.
Here is what I did.
Manifest entry:
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.actions.CREATE_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
Activity code:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
val action = intent?.action
if (NoteIntents.ACTION_CREATE_NOTE == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.CREATE_NOTE -n <yourPackageName>/.MainActivity
val name = intent.getStringExtra(NoteIntents.EXTRA_NAME)
val text = intent.getStringExtra(NoteIntents.EXTRA_TEXT)
val query = intent.getStringExtra(NoteIntents.EXTRA_NOTE_QUERY)
Toast.makeText(this, "$name $text $query", Toast.LENGTH_LONG).show()
}
if (Intent.ACTION_WEB_SEARCH == action) {
//Test this from command line
//adb shell am start -a com.google.android.gms.actions.SEARCH_ACTION -e query "Search for something" <yourPackageName>
val query = intent.getStringExtra(SearchManager.QUERY)
Toast.makeText(this, "Query: $query", Toast.LENGTH_LONG).show()
}
}
For Search (which is working)
INPUT: Say following to google assistance: "Search for nearby stations in my app"
OUTPUT: Toast message - "Query: nearby stations"
For Create a note (not working)
INPUT: Say following to google assistance: "take a note to remind me to get milk"
OUTPUT: Toast message - "null null null"
NOTE: App is uploaded on internal release on play store that is why search is working. Otherwise, the search will also not work.
Thanks in advance.
android
android
edited Nov 9 at 17:43
Nick Felker
5,46111021
5,46111021
asked Nov 9 at 7:39
Rana Ranvijay Singh
3,47832541
3,47832541
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221566%2fhow-to-get-user-input-values-from-intent-when-using-google-assistance-to-interac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown