简体   繁体   English

Android Studio-轻按按钮即可播放声音

[英]Android Studio- Play Sound on button tap WEAR

I am making an app for Android Wear Devices that don't have speakers. 我正在为没有扬声器的Android Wear设备开发应用程序。 For now I am testing. 目前,我正在测试。 How can I make it so when you tap "button1" it does said function that plays, say an MP3 file FROM THE PHONES SPEAKER. 我如何才能做到这一点,当您点击“ button1”时,它确实说起了正在播放的功能,比如说PHONES SPEAKER中的MP3文件。

You'll need to build out a companion phone app to play the sound, and trigger it from Wear, probably using the Message API . 您需要构建一个伴侣电话应用程序来播放声音,并可能使用Message API从Wear触发声音。 The FindMyPhone sample (linked from that doc page) is probably a good place to start, as it's doing something quite similar to your requirements: playing a sound on the phone, triggered by an action on the watch. FindMyPhone示例 (从该文档页面链接)可能是一个不错的起点,因为它所做的事情与您的要求非常相似:在电话上播放声音,并由手表上的动作触发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM