Android即使手机处于锁定和睡眠状态也如何保持音乐播放

编程入门 行业动态 更新时间:2024-10-22 13:47:28
本文介绍了Android即使手机处于锁定和睡眠状态也如何保持音乐播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

移动应用程序开发中的一个新功能,但是尝试使用Android Studio开发在线广播应用程序,但是当该应用程序播放Icecast中的声音时,它会在手机处于锁定和睡眠状态时停止播放.

am new in mobile app development, but have try do develop online radio app using Android Studio, but when the app is playing the sound from Icecast it use to stop when the phone is lock and sleep.

我还发现很难设置可以前进的任何应用的精确宽度,我设置的宽度仅适用于Small Android Screen.该代码充满了具有android 4.0的小型android手机的宽度,但是在大屏幕android手机上,我可以在屏幕的旁边和底部看到一些空间.

Also i find it difficult to set the accurate width that can march any app, the one that i set only work for Small Android Screen. The code full the width of small android phone with android 4.0 but on large screen android phone i can see some space beside and at the bottom of the screen.

主XML代码

推荐答案

您应使用 MediaSession ,因为它旨在帮助您控制媒体播放和控制媒体播放.检查参考,并按照步骤使用MediaSession.

You should use MediaSession since its designed to help you control Media playing and controlling media playback. Check the reference and follow steps for using MediaSession.

更多推荐

Android即使手机处于锁定和睡眠状态也如何保持音乐播放

本文发布于:2023-11-27 08:29:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637288.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:音乐播放   睡眠   状态   手机   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!