App“Alarmy”能从背景状态播放iTunes歌曲......怎么样? [英] App "Alarmy" is able to play iTunes song from background state... How?

查看:539
本文介绍了App“Alarmy”能从背景状态播放iTunes歌曲......怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在倾向于关于在iOS中播放音频的背景状态和权限的所有文档,我无法弄清楚特定应用程序如何能够在未来的某个特定时间唤醒自己并播放非捆绑声音。我正在调查这个问题,因为我想将这个功能(就像我见过的许多其他人一样)添加到我正在构建的应用程序中。

I've been pouring over all documentation regarding background states and permissions for playing audio in iOS and I can't figure out how a particular app is able to seemingly wake itself at a specific time in the future and play non-bundled sounds. I'm looking into the issue because I'd like to add this functionality (like many others I've seen) to an app I'm building.

有问题的应用程序是Alarmy - 以前是睡觉,如果可以的话。这是一个闹钟。与应用程序商店中的大多数其他闹钟不同,它可以播放iTunes歌曲作为闹钟声音而根本不在前台。它可以绕过响铃/静音开关,将音量增加到最大,并在看似(或应该)处于后台状态时从本地iTunes库播放预选的歌曲。

The app in question is "Alarmy" -- formerly "Sleep if you can." It's an alarm clock. Unlike most other alarm clocks in the app store, it is able to play an iTunes song as an alarm sound without being in the foreground at all. It can bypass the ring/silent switch, increase volume to max, and play a preselected song from a local iTunes library when it is seemingly (or should be) in a background state.

我不知道有什么方法可以调查Alarmy在等待闹钟时间时正在做什么,但我可以看到它确实启用了位置服务,启用了蜂窝数据并启用了后台刷新。然而,即使所有这些都在设置中关闭,警报仍然有效并播放iTunes歌曲!我必须假设Alarmy在闹钟时间之前没有播放静音,因为它不会已经通过Apple的提交过程(或者他们可能错过了这个,现在的竞争环境完全不平衡)。

I don't know of any way to investigate what Alarmy is doing while waiting for an alarm time, but I can see that it does have location services enabled, cellular data enabled, and background refresh enabled. However, even with all of these turned off in settings, the alarm still works and plays an iTunes song! I have to assume as well that Alarmy isn't playing silence until the alarm time since it wouldn't have gotten through Apple's submission process (or could they just have missed this, and the playing field is now totally uneven).

它确实有一个看似有点不合适的功能 - 该应用程序显示天气信息。这不一定是完整的毛茸茸 - 我可以看到报警应用程序的一些价值 - 但是他们有可能在足够短的时间间隔内查询某些天气API以使应用程序在后台保持清醒直到闹钟时间?如果是,那会是什么样子?此外,天气API可以免费使用一定数量的查询,但它们有很多下载,我会假设很多查询。对于没有IAP的固定价格付费应用程序,这似乎不是一个很好的商业模式。

It does have a feature that seems a little out of place -- the app displays weather information. This isn't necessarily complete fluff -- I can see some value in that for an alarm app -- but is it possible that they're querying some weather API at short enough intervals to keep the app awake in the background until the alarm time? If they are, what would that look like? Furthermore, weather APIs are free to use up to a certain number of queries, but they have a lot of downloads and I assume a lot of queries. For a fixed price paid app with no IAPs, that doesn't seem like a great business model.

所以,要结束,恕我直言,此功能不能来自任何背景音频权限,因为应用程序在进入后台时不会主动播放音频(除非它的沉默,他们只是幸运,并通过提交过程);它可能来自于在后台持续刷新应用程序以获取位置/天气服务(然后通过简单的计时器倒计时到闹钟点火时间),但是当警报禁用后台刷新和位置服务时,该功能仍然有效。可能是权限存在,所以即使应用程序不允许访问位置信息,iOS仍然允许它在后台激活吗?

So, to wrap up, IMHO, this feature can't come from any Background Audio permissions since the app isn't actively playing audio when it enters the background (unless its silence and they simply got lucky and slipped through the submission process); it may come from continually refreshing the app in the background for location/weather services (and then via a simple timer counting down to the alarm fire time) but the feature still works when background refresh and location services are disabled for the alarm. Could it be that the permissions are there, so even though the app isn't allowed to access the location information, the iOS still allows it to be active in the background?

最后一个想法:是否有一种静音推送技术,他们可能会在事件发生时向应用程序发送通知,并检查是否有时间播放警报音?在黑暗中拍摄...

One last thought: is there a silent push technique whereby they may be pushing a notification to the app at the time of the event and checking to see if it is time for the alarm tone to play? Shot in the dark there...

对此事的任何见解都会有所帮助!我把头发拉出来!我可以编辑这篇文章并添加更多信息 - 即我已经看过哪些资源 - 如果你愿意,但我相当确定我已经查看了所有可能的资源。再次,非常感谢任何帮助。

Any insight into the matter would help a ton! I'm pulling my hair out! I can edit this post and add more information -- i.e. what resources I've already looked at -- if you like, but I'm fairly certain that I've looked at every possible resource out there. Again, tremendous thanks for any help.

推荐答案

他们正在使用音频后台模式,它在info.plist中列出。
他们使用捆绑中的NoSound.mp3文件在后台播放静音。
他们还有一个睡眠音乐模式让他们通过AppStore。

They're using the audio background mode, it's listed in their info.plist. They use the "NoSound.mp3" file in their bundle to play silence, while in the background. They also have a "Sleep music" mode to get them through the AppStore.

对于其他可以使用的方式,请查看这篇文章

For other ways that you can use, check out this article.

这篇关于App“Alarmy”能从背景状态播放iTunes歌曲......怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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