Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Assistant App Actions for AntennaPod #4417

Merged
merged 12 commits into from Jan 24, 2021

Conversation

mgborowiec
Copy link
Contributor

@mgborowiec mgborowiec commented Sep 10, 2020

This pull request adds support for Google Assistant App Actions in AntennaPod. Demo videos available here and here.

App Actions Overview

App Actions let developers integrate their mobile applications with Google Assistant to enable tasks in the app directly from the Assistant. App Actions are supported on Android 5 (API level 21) and higher. Further documentation available here.

Implemented Features

This pull request implements the “Open app feature” built-in intent to enable users to navigate to the most relevant features of AntennaPod, like Downloads, Subscriptions, Playback History, Queue and Episodes directly from the Assistant with queries like “Open Downloads on AntennaPod” or “Show me History on AntennaPod”.

It also implements the “Get thing” built-in intent to enable users to use the in-app search of AntennaPod directly from the Google Assistant with queries like “Search for BBC on AntennaPod”.

Testing

It can be tested with the App Actions test tool plugin in Android Studio. App Actions can only be tested with a physical device.

Deployment

There are further steps required to be taken by the maintainers for deployment, including uploading the app (containing actions.xml) to the Google Play console for publishing as well as filling out a deployment request form (sample answers below). Guidelines for deployment can be found here and here.

Suggested answers for the deployment form:
Summary: Navigate to the popular features and perform in-app search from Google Assistant.

Description: Examples of supported queries include “Open Downloads on AntennaPod”, “Show me History on AntennaPod”, “Search for BBC on AntennaPod”.

This project was a part of Google STEP internship.

Closes #3806

… comments and specified entity set in actions.xml.
* Implemented in-app search with Google Assistant

* Updated a comment to split long sentences
* Implemented in-app search with Google Assistant

* Updated a comment to split long sentences

* Change urls to match the original package name
Copy link
Member

@ByteHamster ByteHamster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for working on this.

I added a few comments below. Additionally, please have a look at the integration tests on CircleCI. They currently fail because of some minor code style issues :)

app/src/main/res/xml/actions.xml Outdated Show resolved Hide resolved

feature = feature.toLowerCase();
switch (feature) {
case "downloads":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty similar to the switch in loadFragment. Could that one be re-used instead of creating another switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature names (and therefore, the parameters used in a potential user query in the Assistant) don’t exactly match the Strings in the loadFragment switch so it’s not possible to simply re-use it. One solution would be to add an additional method to convert the strings first, which would then get rid of the second switch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as the identifier specified in actions.xml (entity identifier="DOWNLOADS")? If so, why do you use lower case here and upper case in actions.xml?

@keunes
Copy link
Member

keunes commented Sep 13, 2020

Nice. Without knowing anything about development: Does this also introduce pause & resume commands mentioned in the feature request?

@mgborowiec
Copy link
Contributor Author

Nice. Without knowing anything about development: Does this also introduce pause & resume commands mentioned in the feature request?

This pull request uses Google Assistant App Actions and introduces the “open app feature” and “get thing” (in-app search) functionality. There exist other frameworks that could be used to introduce commands mentioned in the feature request (https://developer.android.com/guide/topics/media-apps/interacting-with-assistant).

@keunes
Copy link
Member

keunes commented Sep 20, 2020

This pull request uses Google Assistant App Actions and introduces the “open app feature” and “get thing” (in-app search) functionality. There exist other frameworks that could be used to introduce commands mentioned in the feature request (https://developer.android.com/guide/topics/media-apps/interacting-with-assistant).

Thanks :) If i interpret that answer correctly (again, I'm not a developer), pausing/rewinding/resuming isn't possible yet with this PR. If that's the case, I don't think it 'closes' #3806, which specifically requests this:

I currently listen to AntennaPod on my Android phone (using the phone speakers) when I'm in the house and when I'm driving. I want to be able to quickly talk to my phone and say "Ok Google, Pause Antenna Pod" or "Ok Google, Rewind Antenna Pod"

Not saying support for this has to be added now, but I'd remove the 'close' command from the description :)

@ByteHamster
Copy link
Member

I think we already do the things necessary to support play/pause. At least the MediaSession handling in https://developer.android.com/guide/topics/media-apps/interacting-with-assistant is implemented.

Copy link
Member

@ByteHamster ByteHamster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still trying to setup the test tool (this needs more setup than I expected) but in the meantime, I have 2 more comments :)

app/src/main/res/xml/actions.xml Outdated Show resolved Hide resolved

feature = feature.toLowerCase();
switch (feature) {
case "downloads":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as the identifier specified in actions.xml (entity identifier="DOWNLOADS")? If so, why do you use lower case here and upper case in actions.xml?

@keunes
Copy link
Member

keunes commented Nov 29, 2020

Hi @ByteHamster @mgborowiec
What's going on with this PR? I'm preparing the interview with the Blind Tech Guys podcast and had to think of this voice control improvement :)

@ByteHamster
Copy link
Member

I finally managed to set this up on my device. Still not sure if the localization works. When I select another language than English it does not seem to recognize the identifiers and just sends the entered text to AntennaPod. Also, I am unable to actually use the voice feature like in the demo videos - it only works from the actions test tool. There is not a lot of example code available, unfortunately, and there seem to be not many open-source projects that use this.

I just found some conversations about early versions of the PR but I did not find solutions there either.

Maybe we could just push this to Google in the next update to test more easily but tell nobody that it is included.

@keunes @tonytamsf Do you think the Google Assistant query Search for x on AntennaPod should search for episodes/subscriptions within the app or for new subscriptions on the "add podcasts" screen?

@tonytamsf
Copy link
Member

tonytamsf commented Jan 23, 2021

@ByteHamster my initial reaction is to search for new podcasts, but after playing with the app with queue search, episode search in a feed, I think the voice search would be a good feature to search for what is already on my phone.

This would make finding something much simpler. I realize I don't use the search feature because it is often hidden. I just found today that there is a search for queue :)

Once we can search locally, then via the assistant, we can layer the search for new podcasts, through verbal interaction later. I think Google has a iterative search feature.. when you don't find what you are looking for.

Update: I have been thinking of what the user would expect the default search for a podcast app, and I think they expect to search for a new podcast that does not exist yet.

Use case 1: They heard about a badminton podcast, so they want to search for and subscribe to 'badminton' on AntennaPod.

I think most AntennaPod users play episode from the queue, vs searching for an episode and playing.

@keunes
Copy link
Member

keunes commented Jan 24, 2021

Maybe we could just push this to Google in the next update to test more easily but tell nobody that it is included.

Sounds like a good idea

Do you think the Google Assistant query Search for x on AntennaPod should search for episodes/subscriptions within the app or for new subscriptions on the "add podcasts" screen?

I would say search within what's already in the app. I reckon that adding a new podcast is more exceptional than playing existing content. Since many users don't use the queue, I imagine they look for specific content to listen to depending on the mood/interest.

I don't know if it's possible, but I would reckon that adding a new podcast deserves its own command, like Add new podcast on AntennaPod (about x).

@ByteHamster
Copy link
Member

I just found today that there is a search for queue :)

Actually, that one just searches everywhere. Basically every screen has a search feature and only the podcast-specific ones limit the items searched.

I think Google has a iterative search feature

I don't know if it's possible, but I would reckon that adding a new podcast deserves its own command, like Add new podcast on AntennaPod (about x).

I don't know enough about Google Assistant and I don't use it personally. So this would have to be implemented by someone else.

I think most AntennaPod users play episode from the queue

Not sure if this is true. Sometimes I wish we had at least a tiny bit of analytics.

I would say search within what's already in the app.

I think they expect to search for a new podcast that does not exist yet.

I will set it to app-local search but to cover both use-cases we could display a button that opens "add podcast" search when there are no results.

@ByteHamster ByteHamster merged commit cd23ecc into AntennaPod:develop Jan 24, 2021
@ByteHamster
Copy link
Member

Thanks!

@keunes
Copy link
Member

keunes commented Jan 24, 2021

So no communication about this yet, right? Or we can test in the beta release? It's possible to test OK Google from your phone's assistant, right?

@ByteHamster
Copy link
Member

It should be available in the next beta release and can be tested with "Ok Google" (as soon as it is approved by Google, for which we are also dependent on mfietz. I already asked him to apply for Assistant approval).

So no communication about this yet, right?

Yes, please don't post it on Twitter or in the release notes. I want to see if it works before we make it public.

@antennapod-bot
Copy link

This pull request has been mentioned on AntennaPod Forum. There might be relevant details there:

https://forum.antennapod.org/t/voice-command-to-resume-latest-podcast/3997/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Google Assistant/"Ok Google" integration
5 participants