Android的锁屏和键盘控制 [英] Android Lock Screen and Keyboard Controls

查看:654
本文介绍了Android的锁屏和键盘控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一部分的方式,通过编写一个媒体播放器的应用程序为Android。这一切都进行得很顺利,到目前为止,但是我现在达到了困难的阶段!

I am part way through writing a media player app for Android. It's all going really well so far, however I am now reaching the difficult stage!

我有两个问题。我需要实现一个服务活动?据我了解,这是必需的,以允许应用程序继续在后台运行。然而,当我移动到平板电脑上的其他程序,并返回到应用程序没有问题,我的工作正常。是否有人可以解释什么优点是服务?

I have two questions. Do i need to implement a service activity? As I understand it, this is required to allow the app to continue working in the background. However, mine is working fine while I move to other programs on the tablet, and returns to the app without problems. Can someone please explain what the advantages are of services?

其次,我想媒体播放器与ICS标准的锁屏控件整合,也使其利用具有键盘播放/暂停控制跳过片(如华硕变压器)的。我想AP preciate,如果有人可以点我在正确的方向让我开始。从我在Google上搜寻它似乎BroadcastReciever是必要的,或者RemoteControlClient,但我不知道从哪里开始!

Secondly, I would like to integrate the media player with the standard lock screen controls in ICS, and also make it take advantage of tablets (such as the asus transformer) that have keyboard play/pause skip controls. I would appreciate it if someone could point me in the right direction to get me started. From my googling it would seem that BroadcastReciever is needed, or perhaps RemoteControlClient, but I've no idea where to start!

我有动作条选项卡,其中包含音乐播放片段,很快一个主要活动视频播放器片段。

I have a main activity with actionbar tabs, which contain a music player fragment and soon a video player fragment.

我是否需要专门创建一个布局锁屏,或者我可以使用标准的API的?

Do i need to create a layout specifically for the lock screen, or can i make use of standard API's?

任何帮助感激地接受!

推荐答案

您应该检查出随Android SDK中的样本随机音乐播放器样品。它给你的锁屏界面的控件和ICS的设备与功放蓝牙控制能力;向上。我用它自己,它是优秀的。此外,在Github上UniversalMusicPlayer示例: https://github.com/googlesamples/android-UniversalMusicPlayer

You should check out the Random Music Player sample that comes with android SDK samples. It gives you lock screen controls and bluetooth control ability on ICS devices & up. I've used it myself, it is excellent. Also, the UniversalMusicPlayer sample on Github: https://github.com/googlesamples/android-UniversalMusicPlayer

样品code 可以在网上找到了。

伊戈尔

这篇关于Android的锁屏和键盘控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆