为我的应用程序使用锁定屏幕? [英] Using lock screen for my app?

查看:125
本文介绍了为我的应用程序使用锁定屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的应用程序在多任务处理时使用锁定屏幕上的音频按钮。
(是的,就像Pandora一样。)
我想使用什么API?

I'd like to make my app use the audio buttons on the lock screen while multitasking. (Yes, like Pandora.) What API am I looking to use?

推荐答案

查看多媒体远程控制文档。基本上,你只需要在你的共享应用程序实例上调用 -beginReceivingRemoteControlEvents ,然后注册一些东西(可能是你的主视图控制器)作为第一个响应者并实现 -remoteControlReceivedWithEvent:方法就可以了。您将从锁屏控件和耳机点击器以及多任务抽屉左侧的控制按钮获取事件。要在应用程序不是最重要的时候播放音频,您还应该查看此信息关于背景音频。

See the Remote Control of Multimedia docs. Basically, you just need to call -beginReceivingRemoteControlEvents on your shared application instance, then register something (probably your main view controller) as the first responder and implement the -remoteControlReceivedWithEvent: method on it. You will get events both from the lock-screen controls and from the headset clicker, as well as the control buttons to the left of the multitasking drawer. To play audio while your application isn't foremost, you should also check out this information on background audio.

这篇关于为我的应用程序使用锁定屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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