Download the code package

This case is to play, pause, stop, and increase or decrease the music volume of one Hongmeng mobile phone by controlling another mobile phone. It is a demo to show the cross-device communication ability of Hongmeng.

The code download address of this live broadcast is here, those who need it can download it.

Download the code package

Key Class Description:

MainAbilitySlice is the code of the page, including launching the remote APP, sending the playback command, listening to the volume event, etc.

PalyAbility is a Service that provides a music playback Service with the actual music playback controls inside.

Utils /DeviceUtils is the code that encapsulates the discovered device.

UI /DeviceSelectDialog is a wrapped popup lookup device page that has page listening events that are ultimately handled in MainAbilitySlice.

Author: helloworld329

For more information, visit Harmonyos.51cto.com, a collaboration between 51CTO and Huawei