应用程序“警报"能够从后台播放 iTunes 歌曲...如何? [英] App "Alarmy" is able to play iTunes song from background state... How?

查看:22
本文介绍了应用程序“警报"能够从后台播放 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"——以前是Sleep if you can".这是一个闹钟.与应用程序商店中的大多数其他闹钟不同,它可以将 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.

这篇关于应用程序“警报"能够从后台播放 iTunes 歌曲...如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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