Gru*_*kes 11 ios core-telephony
Navita https://itunes.apple.com/us/app/navita-tem-personal/id590228620?mt=8如何 设法显示通话记录?
如果我将应用程序从任务管理器中滑出,那么它会错过调用,这表明它必须使用CTCallCenter的callEventHandler,并通过保存响应callEventHandler回调的时间/持续时间来创建自己的调用日志.
但是,如果是这种情况,那么它如何设法在后台执行此操作?我的印象是callEventHandler只能被前景中的应用程序使用而不能被后台使用?
该应用程序正在使用位置服务,但即使在禁用此功能后,它仍然可以获取有关呼叫的信息(前提是应用程序未被暂停).我虽然可能正在使用后台位置更新来保持自己准备接收callEventHandler回调但显然不是.
Navita应用程序还能够显示通话时间和通话时长.
赏金将被授予一个答案,其中包含足够,准确和详细的信息,使我能够模仿Navita应用程序的行为,特别是我必须能够编写一个应用程序,可以获得发生的电话呼叫的时间和持续时间虽然应用程序不在前台,但设备的位置服务已关闭,并且应用程序在后台运行的时间超过了使用beginBackgroundTaskWithExpirationHandler授予的~3分钟:
Here is what I observe with the Navita app that I want to be able to reproduce:
1) Run app
2) Task away from app
3) Go to device settings, privacy, and turn off Location Services.
4) Go to device settings, privacy, background app refresh and turn off for the app
5) Wait > 10 minutes to make sure the app is not still in the background as a consequence of using beginBackgroundTaskWithExpirationHandler:
6) Call the device from another phone, answer the phone call, then hang up.
7) Launch the app again and display the call time and duration
Run Code Online (Sandbox Code Playgroud)
(这是iOS7并且没有越狱)
以下是我从 Navita TEM 反汇编中发现的内容及其资源。
应用程序使用两种背景模式 - 位置和音频。您可以在 Info.plist 文件中看到它。当您启用电话呼叫记录应用程序时,还将启用“警报”和“实时”开关。当“警报”启用的应用程序在没有声音的背景“bg-sound.mp3”文件中无限循环时,它只是沉默。因此,它不使用像这样的黑客How to get a call event using CTCallCenter:setCallEventHandler: that在应用程序暂停时发生?。这与用于保持应用程序在后台运行并接收电话事件的位置类似。不知怎的,这并没有被 AppStore 拒绝。