Thursday, October 4, 2018

Verifying Your Google Assistant Media Activity Integrations On Android

Posted yesteryear Nevin Mital, Partner Developer Relations

The Media Controller Test (MCT) app is a powerful tool that allows y'all to evidence the intricacies of media playback on Android, together with it's only gotten fifty-fifty to a greater extent than useful. Media experiences including vocalization interactions via the Google Assistant on Android phones, cars, TVs, together with headphones, are powered yesteryear Android MediaSession APIs. This tool volition assistance y'all verify your integrations. We've similar a shot added a novel verification testing framework that tin travel used to assistance automate your QA testing.

The MCT is meant to travel used inward conjunction amongst an app that implements media APIs, such every bit the Universal Android Music Player. The MCT surfaces information almost the media app's MediaController, such every bit the PlaybackState together with Metadata, together with tin travel used to evidence inter-app media controls.

The Media Action Lifecycle tin travel complex to follow; fifty-fifty inward a uncomplicated Play From Search request, in that place are many intermediate steps (simplified timeline depicted below) where something could larn wrong. The MCT tin travel used to assistance highlight whatever inconsistencies inward how your music app handles MediaController TransportControl requests.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Previously, using the MCT required a lot of manual interaction together with monitoring. The novel verification testing framework offers one-click tests that y'all tin run to ensure that your media app responds correctly to a playback request.

Running a verification test

To access the novel verification tests inward the MCT, click the Test clit adjacent to your desired media app.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

The adjacent concealment shows y'all detailed information almost the MediaController, for instance the PlaybackState, Metadata, together with Queue. There are 2 buttons on the toolbar inward the transcend right: the clit on the left toggles betwixt parsable together with formatted logs, together with the clit on the right refreshes this sentiment to display the most electrical current information.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

By swiping to the left, y'all larn inward at the verification tests view, where y'all tin encounter a scrollable listing of defined tests, a text plain to travel inward a question for tests that demand one, together with a department to display the results of the test.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

As an example, to run the Play From Search Test, y'all tin travel inward a search question into the text plain together with thus hitting the Run Test button. Looks similar the evidence succeeded!

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Below are examples of the Pause Test (left) together with Seek To evidence (right).

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android  app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Android TV

The MCT similar a shot also plant on Android TV! For your media app to travel amongst the Android TV version of the MCT, your media app must cause got a MediaBrowserService implementation. Please encounter here for to a greater extent than details on how to create this.

On launching the MCT on Android TV, y'all volition encounter a listing of installed media apps. Note that an app volition entirely look inward this listing if it implements the MediaBrowserService.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Selecting an app volition cause got y'all to the testing screen, which volition display a listing of verification tests on the right.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Running a evidence volition populate the left side of the concealment amongst selected MediaController information. For to a greater extent than details, delight banking enterprise represent the MCT logs inward Logcat.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

Tests that demand a question are marked amongst a keyboard icon. Clicking on 1 of these tests volition opened upwards an input plain for the query. Upon hitting Enter, the evidence volition run.

 app is a powerful tool that allows y'all to evidence the intricacies of media playback on Andro  Verifying your Google Assistant media activity integrations on Android

To brand text input easier, y'all tin also purpose the ADB command:

adb rhythm out input text [query]

Note that '%s' volition add together a infinite betwixt words. For example, the command adb rhythm out input text hello%sworld volition add together the text "hello world" to the input field.

What's next

The MCT currently includes uncomplicated single-media-action tests for the next requests:

  • Play
  • Play From Search
  • Play From Media ID
  • Play From URI
  • Pause
  • Stop
  • Skip To Next
  • Skip To Previous
  • Skip To Queue Item
  • Seek To

For a technical deep dive on how the tests are structured together with how to add together to a greater extent than tests, see the MCT GitHub Wiki. We'd dear for y'all to submit push clit requests amongst to a greater extent than tests that y'all remember are useful to cause got together with for whatever põrnikas fixes. Please brand certain to review the contributions process for to a greater extent than information.

Check out the latest updates on GitHub!

Related Post

Verifying Your Google Assistant Media Activity Integrations On Android
4/ 5
Oleh