Open In App

How to Use Media Toolkit to Develop WearOS Media Apps?

Last Updated : 26 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

With the introduction of additional devices over the last two years, Wear OS usage has increased. Users now frequently utilize media apps to listen to podcasts, play music, and follow workout plans. You may now see WearOS Devices more common than ever and the year 2023 is expected to land a whole bunch of them, ranging from various screen sizes to various hardware functionalities, with the major players adapting this new design overhaul, in this Geeks for Geeks article, we will be discussing how you can take better approaches to optimize your apps to be ready to launch on the new WearOS. As with the other Wear Jetpack libraries you use, Compose for Wear OS is a component of Android Jetpack and lets you develop better code more quickly.

Examples of media usage

Consider these two crucial use cases when you begin to create your media app:

  • Listen to music, podcasts, or a radio station over any network that is accessible with streaming.
  • Play downloaded content: Users can download podcasts or music to listen to while exercising without a network connection.

ProTip: The recently released Assistant experience on the watch and Wear’s built-in media controls already make it possible for some users to start and control media content on the phone using Wear OS media apps.

Therefore, to provide customers with the optimal experience, developers must take additional factors into account when creating the watch:

  1. Use Bluetooth speakers or headphones instead of using the watch speakers for audio.
  2. Turn on the audio offloading
  3. Pinging the network connection should only be done when absolutely essential.

Current Activity

In Wear OS 3, a new feature called an Ongoing Activity makes it possible for an Ongoing Notification to show up on more surfaces inside the Wear OS user interface. Users are able to maintain more interest in prolonged activities thanks to this. This functionality helps apps for fitness and media. Both recent applications and the watch face display ongoing activity. When the Ongoing Activity notification is selected in your app, the player screen should automatically open. This enables the user to complete a task fast, such as stopping music that is playing.

Avoid using watch speakers to play media

The majority of Wear OS gadgets feature speakers. Watch speakers can be used for calls and guided activities, but they are not intended for listening to media material, therefore they don’t provide the best experience. Your software should make sure to play music when Bluetooth speakers or headphones are connected to the watch in order to provide the greatest user experience.

This is made simple with the Media Toolkit. It offers a particular Media3 extension that beautifies the ExoPlayer instance and prevents unintentional playback in advance of sound being produced. This is done by determining whether the current audio output is coming from a Bluetooth device. In the event that it does not, the toolkit opens the Bluetooth settings flow and enables connection.

Avoid using the network unless it is absolutely required

The toolbox makes media download optimization straightforward. To schedule downloads, it offers a MediaDownloadService that is implemented with Media3’s DownloadManager and Androidx Work Manager. The NetworkAwareness module, which enables developers to map network activities with network type, is used to achieve this. To provide a better performance, Media3 activates all necessary foreground and notification services, and the sample app code instructs the Work Manager to execute downloads only when a Wi-Fi connection is available. 

When they play media, many people forget their phones. Even when a network connection is available, listening to downloaded content results in significant power savings for the user. You should plan for users to have constrained network connectivity when developing for Wear.

Performance-related factors

The download process as well as stream and downloaded music playback optimization are key to making sure your app performs well. There are specific app choices that you need to take into account to make an app operate well on the watch. The Wear media toolkit assists in laying the groundwork for a performant app by offering features like the Network Awareness module to determine the best connection for a given operation.

Streaming considerations

  • Avoid the situation where a user enters a location with a weak or no signal, is streaming material, and the music stops abruptly because the network connection has been lost.
  • Choose a low bitrate for streaming, such as 48 kbps, and codecs like AAC and MP3, to optimize the content.
    To ensure that playback doesn’t stop if your connection drops out for a moment, optimize your prefetch technique for photos and tracks.
  • Test your app on every network configuration, including Wi-Fi, LTE, and a Bluetooth-enabled watch. Test the watch’s network switching capabilities as well.

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads