11

How does Navita https://itunes.apple.com/us/app/navita-t.e.m.-personal/id590228620?mt=8 manage to display a call log?

If I swipe the app out of the task manager then it misses the calls, this indicates that it must presumably be using CTCallCenter's callEventHandler and is creating its own call log by saving the time/duration in response to the callEventHandler callbacks.

However if that is the case then how does it manage to do this in the background? I was under the impression that callEventHandler can only be used by apps in the foreground and not in the background?

The app is using location services, however even after disabling this it was still able to get information about the calls (provided the app isn't suspended). I though it might be using background location updates to keep itself primed to receive callEventHandler callbacks but apparently not.

The Navita app is additionally able to display call time and call duration.

The bounty will be awarded to an answer which contains sufficient, accurate and detailed information that enables me to emulate the behavior of the Navita app, specifically I must be able to write an app that can obtain the time and duration of a phone call that occurred while the app was not in the foreground, while the device's location services was turned off, and after the app had been in the background longer than the ~3 minutes granted by using beginBackgroundTaskWithExpirationHandler:

   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

(This is iOS7 and unjailbroken)

Gruntcakes
  • 37,738
  • 44
  • 184
  • 378

2 Answers2

4

Here is what I've found from Navita TEM disassembly and it's resources.

Application uses two background modes - location and audio. You can see it in the Info.plist file. When you enable phone calls logging application will also enable "alerts" and "Real-time" switches. When "alerts" enabled application infinitely loops in background "bg-sound.mp3" file which has no sound, it's just silence. Because of that it doesn't use hacks like this one How to get a call event using CTCallCenter:setCallEventHandler: that occurred while the app was suspended? . It's similar trick to location used in order to keep the app running in background and receive phone call events. Somehow this was not rejected from the AppStore.

Community
  • 1
  • 1
creker
  • 9,400
  • 1
  • 30
  • 47
2

If you are observing the call center while the app is in the background you get a set of updates when the app is brought back to the foreground. This set of data may not be as accurate as if the app had been mostly in the foreground but it does include quite a bit of info.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • Thanks. If the app was in the background for a long time, days or weeks, would the updates be truncated and limited the most recent N? – Gruntcakes Jan 17 '14 at 18:38
  • It should contain one event for each call. The reduction of data is that you only get 1 per call. – Wain Jan 17 '14 at 18:45
  • I'm not able to get this working at all. Are you able to comment on what I'm doing wrong or not doing? Thanks http://stackoverflow.com/questions/21195732/how-do-you-get-information-on-retrospective-calls-using-calleventhandler – Gruntcakes Jan 17 '14 at 20:59
  • "it does include quite a bit of info." CTCall only has callState and callID, nothing about start/end times or call duration. However if I make a call while the Navita app is not in the foreground, then it is still able to get the call time and duration. Which implies it is not obtaining this information from CTCall? – Gruntcakes Jan 20 '14 at 18:30
  • When running continuous gps updates I get a call update each time the location changes so I know the time details of the call. – Wain Jan 20 '14 at 18:38
  • Even if location services is disabled on the phone? – Gruntcakes Jan 20 '14 at 18:39
  • I haven't tried, but that would seem unlikely. CTCall is the only official source of call data. – Wain Jan 20 '14 at 18:41
  • The Navita app can get the call time/duration even if location services are disabled, hence this indicates its not getting CTCall info when the app is brought back to the foreground as the CTCall doesn't include this info. Hence its still a mystery how its doing this. (Its presumably not using another background mode such as voip or audio to keep going in the background in order to monitor the call as it ought to have got rejected from the app store if that was the case as its not an audio or voip app.) – Gruntcakes Jan 20 '14 at 19:00