iOS Observe Call State Logs via heard daemon (accessibility service) - ios

I am doing some iPhone automation and want to observe call states of ongoing calls. I implemented a listener to read the idevicesyslog and fetch log output of com.apple.accessibility.heard, which is printing each state change similar to the following lines (stat=Sending and stat=Active):
ay 13 02:14:02 heard(HearingUtilities)[11392] <Notice>: -[HUComfortSoundsController callStatusDidChange:]:415 Phone call holding 0 [pending = 1, active = 0, avc = 0, endpoint = 1] - NSConcreteNotification 0x102f173f0 {name = TUCallCenterCallStatusChangedNotification: object = <TUProxyCall 0x102f47080 p=com.apple.coretelephony aPI=(null) svc=Telephony hdl=<TUHandle 0x103407870 type=PhoneNumber, value=+4912345, normalizedValue=+4912345, isoCountryCode=de> isoCC=de stat=Sending tStat=0 dR=0 fR=0 supportsR=1 uPI=57FCA1D2-D09F-4E23-A08A-3AD4B18B570D grp=(null) lSIUUID=00000000-0000-0000-0000-000000000001 lSIAccountUUID=AA1FC9E6-068E-4D86-B3B9-C1074658AFB2 hosted=1 endpt=1 callerNFN=(null) srcID=(null) aC=(null) aM=(null) iUB=1 vm=0 connStat=00 nMICS=0 sR=0 iSA=0 iSV=0 iSS=0 wHM=0 hSI=0 vST=0 iapST=0 oapST=0 vCA=<TUVideoCallAttributes 0x102f17330 remoteCameraOrientation=0 localVideoContextSlotIdentifier=0 remoteVideoContextSlotIdentifier=0> model=<TUCallModel 0x102f3e380 hold=1 grp=1 ungrp=1 DTMF=1 uMPS=1 aC=1 sTV=0> em=0 iFE=0 sos=0 sSR=1 sSUI=0 mX=0<\M-b\M^#\M-&>
May 13 02:14:14 heard(HearingUtilities)[11392] <Notice>: -[HUComfortSoundsController callStatusDidChange:]:415 Phone call holding 0 [pending = 0, active = 1, avc = 1, endpoint = 1] - NSConcreteNotification 0x10321ab80 {name = TUCallCenterCallStatusChangedNotification: object = <TUProxyCall 0x102f47080 p=com.apple.coretelephony aPI=(null) svc=Telephony hdl=<TUHandle 0x103330670 type=PhoneNumber, value=+4912345, normalizedValue=+4912345, isoCountryCode=de> isoCC=de stat=Active tStat=0 dR=0 fR=0 supportsR=1 uPI=57FCA1D2-D09F-4E23-A08A-3AD4B18B570D grp=(null) lSIUUID=00000000-0000-0000-0000-000000000001 lSIAccountUUID=AA1FC9E6-068E-4D86-B3B9-C1074658AFB2 hosted=1 endpt=1 callerNFN=(null) srcID=(null) aC=AVAudioSessionCategoryPhoneCall aM=(null) iUB=1 vm=0 connStat=11 nMICS=0 sR=0 iSA=0 iSV=0 iSS=0 wHM=0 hSI=1 vST=0 iapST=0 oapST=0 vCA=<TUVideoCallAttributes 0x102f17330 remoteCameraOrientation=0 localVideoContextSlotIdentifier=0 remoteVideoContextSlotIdentifier=0> model=<TUCallModel 0x1032596b0 hold=1 grp=1 ungrp=1 DTMF=1 uMPS=1 aC=1 sTV=1> em=0 iFE=0<\M-b\M^#\M-&>
Unfortunately, starting from newer iOS versions (maybe 15.4 or 15.x already, don't know exactly), the heard service is killing itself after 3 minutes:
May 13 02:28:03 heard(Accounts)[11501] <Notice>: "The connection to ACDAccountStore was invalidated."
May 13 02:28:03 heard(Accounts)[11501] <Notice>: "The connection to ACDAccountStore was invalidated."
May 13 02:30:21 heard(HearingUtilities)[11501] <Notice>: -[AXHeardController shutdownIfPossible]:355 heard still shouldn't be running. Shutting down.
It is restarting after i am opening the settings-> accessibility settings via phone menu. Does anybody have an idea what I can do about this? I thought about following things:
Include heard service / accessibility in an own app, so that it will stay online when app is active
Get call states in another way? I tried an observer inside an app, but when it is running in background, it will not react anymore.
Some iOS setting to enable it permanently
Will this be fixed in an upcoming version?
The com.apple.accessibility.heard seems to be an internal service, does anybody know how to deal with it now?
Otherwise i would also be happy for a hint how to solve this without observing logs. As I said, CallObserver in my swift app is problematic, as it is not working in background.

Related

Background Service in Appcelerator titanium for iOS

I am facing some problem in background service.I have registered the backgrond service like:var service = Ti.App.iOS.registerBackgroundService({url:'/bgservice.js'});
in bgservice.js :I actually want to check the DB(where the data execution time is>8mins) and trigger local notification.But it is not working.So tried a sample first like this,to see how much time the app is active in background:
var timer = setInterval(startsampletest, 6000);
startsampletest();
function startsampletest(){
count=count+1;
Ti.API.info("1.!!!!!*******startsampletest is called for"+count);
}
which gives me only 5 times every 6 seconds so it is executing only for 30 min(please correct me if I am wrong)But in axway documentation it says the bgservice will be active for 10 mins.
Can anyone pls help me on this.I want the app to be active in background for 10 mins.pls let me know if I have made any mistakes.
It is not guaranteed that a background task created by Ti.App.iOS.registerBackgroundService() will run up to 10 minutes,
see: https://titaniumsdk.com/api/titanium/app/ios/backgroundservice.html#background-service-limitations
... typically to no more than 10 minutes.
But more crucial is that
The OS may terminate the background service at any point to reclaim resources.
For longer background tasks under iOS you have to use
the Ti.URLSession module (com.appcelerator.urlSession).
In general, see https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_How-tos/Platform_API_Deep_Dives/iOS_API_Deep_Dives/iOS_Background_Services.html

iOS Meteor Cordova app: all app graphics disappear after a few minutes

I've got a working Meteor Cordova app that installs and runs on both iOS and Android devices. However, on iOS only, and only if the iPhone is not plugged into xCode, all of the graphic assets disappear from the app and show as nothing -- no broken pic image or box outline or different color, just the color of the background as though nothing was ever there. They don't disappear while you stare at the current screen, you have to go to a different screen or leave and return to the app, but once it happens, all the graphics are gone. It doesn't even affect formatting of page content. Just poof, no more graphics.
Since it's on-device only and doesn't happen if plugged into xCode, I haven't been able to get any possible error messages. Plus, the app still works fine. And if I kill the app and restart it, the icons all come back.
Maybe this is a behavior of the internal web server that Cordova does to get around the WKWebView-no-local-assets issue? Maybe it's a code issue (I've had another iOS-only issue that was a string vs number thing in how iOS and Android act differently). But since I can only reproduce it on-device and without connection to debugging, I'm hoping someone knows the answer.
I keep all of my graphics in /public/images, if that's a clue. But the fact that it doesn't happen on Android is really a stumper.
UPDATE:
More info. I've used Xcode to examine the console log and found these log entries that clearly show the image resources are being successfully retrieved.
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Event [162:0x12bd42470]: 1 Err(0)
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Connected [162:0x12bd42470]: Err(0)
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Cancel [162:0x12bd42470]
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Destroyed [162:0x12bd42470]
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didReceiveResponse: (pageID = 2, frameID = 1, resourceID = 239, status = 200)
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didReceiveData: Started receiving data (pageID = 2, frameID = 1, resourceID = 239)
Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didFinishResourceLoad: (pageID = 2, frameID = 1, resourceID = 239)
but then when the problem occurs, the log is this:
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Event [141:0x159e0d9f0]: 3 Err(61)
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Error>: TIC TCP Conn Failed [141:0x159e0d9f0]: 1:61 Err(61)
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Cancel [141:0x159e0d9f0]
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Destroyed [141:0x159e0d9f0]
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(WebKit)[6252] <Notice>: 0x103184b40 - NetworkResourceLoader::start: Retrieving resource from cache (pageID = 2, frameID = 1, resourceID = 224, isMainResource = 0, isSynchronous = 0)
Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Error>: HTTP load failed (error code: -1004 [1:61])
The -1004 error is cannot connect to host. So, this app is successfully getting images from, I think, the internally existing content server, but that breaks after a few minutes.
Does anyone have any ideas? Meteor 1.6, newest xCode, iOS 10, btw. Thanks!
Found the answer on the Meteor forum. In writeups like this:
https://github.com/meteor/cordova-plugin-meteor-webapp/issues/27
it's confirmed that there are issues with the plugin that provides the embedded content server, and macrozone has provided a fix. Install this in your project:
meteor add cordova:cordova-plugin-meteor-webapp#https://github.com/panter/cordova-plugin-meteor-webapp.git#7bb095ce393d17f662cc6bb596ce91acf743d17a
This solves this issue and maybe some white screen of death meteor cordova issues, too. Kudos to macrozone!

SIGPIPE 13 with ASyncUDPsocket

I'm using an NTP framework in my App and it makes use of ASyncUDPsocket, however this framework makes the App break after coming back from the background after a while.
NetworkClock source: https://code.google.com/p/ios-ntp/issues/attachmentText?id=8&aid=6136447331175276042&name=NetworkClock.m&token=ky6UNYWjqChe2rQkEv1a_VSDpqk%3A1372342874389
AsyncUdpSocket source: http://pastebin.com/tuKqpnqZ
Breakpoints are:
[self doSend:[self socketForPacket:theCurrentSend]];
And:
result = sendto(theNativeSocket, buf, (size_t)bufSize, 0, dst, (socklen_t)dstSize);
I tried suggestions here:
https://code.google.com/p/ios-ntp/issues/detail?id=8
But so far the app stills crashes with a iPhone backboardd[28] <Warning>: Application 'UIKitApplication:nl.app[0x8f48]' exited abnormally with signal 13: Broken pipe: 13 error.
How can I prevent this?

RedPark unable to read Data from Serial port: UIViewController vs. UINavigationController

I am using the Redpark Serial SDK 1.4 r270 to help with i/o features for the iphone. One of the issues, that I am currently having is reading the data given using
- (void) readBytesAvailable:(UInt32)numBytes {
Here are my errors.
Feb 8 15:27:50 iapd[897] <Warning>: ERROR - /SourceCache/iapd/iapd-1065.23/iapd/IAPSession.mm:-[IAPSessionBasic _sessionBufferToAppHasSpaceAvailable] - 823 session=0x1 for connectionID=0x1e12ea00 failed to write bytes, errno = 32
Feb 8 15:27:50 iOS[7428] <Warning>: ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-213/EASession.m:-[EASession dealloc] - 137 unable to close session for _accessory=0x20047eb0 and sessionID=65536
Feb 8 15:27:50 iOS[7428] <Warning>: ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-213/EAOutputStream.m:-[EAOutputStream write:maxLength:] - 212 failed to write 229 bytes (wrote -1) with error 9
Feb 8 15:27:50 iOS[7428] <Warning>: ERROR - /SourceCache/ExternalAccessory/ExternalAccessory-213/EAInputStream.m:-[EAInputStream _readInputFromAccThread] - 357 error waiting for read data, errno = 9
This works perfectly works fine with a single view application.
Suppose there is a UINavigationController with view A and view B where A => B when a button is clicked. View B is using the RscMgr thread where all the magic happens to read from the serial port.
At the first instance of the UINavigationController at view B, it works perfectly fine if we stay on this view. We are able to disconnect, connect the port and we will continue streaming the data.
However, if I go back to view A then back to view B. Everything goes to hell. I cannot read the data anymore from this function, and I found (MULTIPLE) errors in the console. Does anyone have a good reason as to why this happened and how we can fix it? I know we have popped the UIViewController off the stack and everything resets and the RscMgr thread is created again but nothing is being viewed. I am unsure on how to clear the buffer using the SDK since it is not provided.
This is simpler than the solution above. Define your function in a different .m file, and have this launch from AppDelegate, not the ViewController.
I had this issue with former apps I wrote. The other option is to declare RscMgr in App Delegate, but then have it initialized in the given ViewController.
The scope you've declared
- (void) readBytesAvailable:(UInt32)numBytes {
in is likely the problem. I would declare this somewhere that does not go away when you open and close B. Such as on the UINavigationController, or on your AppDelegate.
Better yet, create a new singleton class that manages the interface to RedPark, and query it from the rest of your app as needed.

adsheet warning

can anyone explain the meaning/reason of this adsheet warning please?
Nov 23 09:24:06 unknown AdSheet[256] <Warning>: AdSheet running for 59.992 seconds with 1 clients and 1 assertions [banner:1]: info.company.app (State: Foreground Running) (Background: 0, no timer) has 1 banners: 0xee74b00:EDFD972C-2C31-45A6-A57C-F129F8D0CB97 (created 2011-11-23 17:23:44 +0000) [Visible: never] [In Window: YES]
it repeats every 20 seconds (in the log) and increments the "running for xx.xx seconds" with 20 seconds each time.
It comes up in the log with my iAd supported application and regardless whether the Test Advertisement is loaded or not.
after I kill the application it continues two or three times with:
Nov 23 09:33:06 unknown AdSheet[256] <Warning>: AdSheet running for 599.993 seconds with 0 clients and 0 assertions []:
and then it stops
thank you
I'm pretty sure the [Visible: never] has to do with the warning. Are you sure your AdSheet is visible and entirely on the screen? Did you by any chance accidently add a copy of the AdSheet to your viewController in IB that you don't know of? You should keep in mind that Ads should appear in the foreground.

Resources