The code in updateHanlder (HealthKit) did not work when the watch enter the background - apple-watch

When the watch' screen is on, I can get the feedback(heart rate data) from the updateHanlder block, and do some UI settings(haptic vibration or label setting). However, when I put my wrist down and the screen becomes off, I can not get information NSLoged from the updateHanlder block. I am sure the heart rate sensor is still running and the health app in the iOS client shows that the heart rate data is achieved.
Does anyone know how to solve this problem?

Related

iOS - Capture data when shutter fires

Is there an easy way to capture gyroscope at the exact time the shutter is fired on the camera? I am currently using the IUImagePickerController and I can't find an easy way to interrupt or tie into the image taking process.
The closest you'll be able to do is implement:
imagePickerController:didFinishPickingImage:editingInfo:
and save the gps coords and gyro at that time. However its not fired the instance that the shutter is fired but it should be very close. If I were you I recommend just saving GPS location, not the gyro. Not only is it hard to reproduce, but also you wont have the elevation which would change the picture. (ie: if your taking the shot from a skyscrapper.) Also make sure you enable the GPS BEFORE you start the camera so that theres no delay/ask the user for permission.

core location autopause, effects of activity type

Hi does anyone know the effect that using different CLActivity type constants has on the behavior of auto pause? For example, will the location manager resume from a pause more readily if activityType is set to CLActivityTypeAutomotiveNavigation or CLAcitivtyTypeFitness?
Thanks for your help.
The activity type flags affect the internal auto pause logic. For instance CLActivityTypeFitness is more likely to pause when the user is stationary with no accelerometer motion and when the user is moving fast with accelerometer motion similar to a vehicle and vice versa for CLActivityTypeAutomotiveNavigation. CLActivityTypeOther is supposed to be a catch-all setting for everything else. However the exact logic and thresholds are only known to Apple.
As far as I know, the location updates are only resumed if your app becomes active again, there is no auto-resume depending on the user motion. But you can always start region monitoring in your didPause callback to resume tracking again when the user does move.

Background location updates for iOS display GPS icon the entire time

My app runs significant location change updates in the background. However the GPS display icon never turns off..even when app is in the background. Is there a way to use location manager with Significant location change in the background and have the GPS icon NOT display continuously? My users don't understand that it is only periodically obtaining location coordinates and instead think its constantly running in background and thus deleting app thinking its too power intensive. Please help.
I believe that any use of CoreLocation will prompt the location arrow. That includes any of the geofencing CLRegion use, -startMonitoringForSignificantLocationChanges, and -startMonitoringForLocation. I think that is Apple's safeguard that something is using your GPS, even in limited use.
That arrow will be visible till you unregister your application from significant change. But I faced problem, what I can't fine point where I can do this. In my case will be best to unregister on application kill, but with multitasking there is no such ability to handle this moment to unregister.

Response time for a UIButton

I have developed a test for iPod/iPhone (with MonoTouch if that is relevant) that measures reaction time. But I need to take into consideration the time between touching the screen and actual triggering of the button event. Is there any documentation of that?
It's already very hard to almost impossible to get predictable interrupt latency on real time operating systems.
But on the iPhone? Imho impossible. A capacitive touchscreen is not optimal to get results that are exactly the same for each body and location. And if mail.app decides to poll for emails just at the moment you'll touch the screen there will be a bigger delay.
But to make one thing clear, we are speaking about some micro seconds or even less than that.
If you want accurate results you shouldn't use an iPhone. But I guess your app will be some kind of game, so nobody cares if your result is 0.01 seconds off. But I wouldn't show results as 0.381829191 seconds, that fakes accuracy you'll never get on any smartphone.
What is the lowest reaction time you got in your app?
The time between an actual touch and the system registering it will be negligable.
One key thing: if you are detecting the press using touch events like touchUpInside, consider using the touchesDownInside event because touchesUpInside, will not fire until the user's finger leaves the screen.

Getting Framerate Performance on iPhone

I've just come off the PSP where performance testing was easy. You just turned off 'vsync' and printed out the frameratem, then change something and see whether the frame rate goes up or down...
Is there any way to do the same thing on the iPhone? How do you turn vsync off? The Instruments tool is next to useless. Its chief problem being that it running it adversely affects the performance of the app! Also, the frame rate it reports is extremely sporadic.
I don't want any fancy tool that reports call trees and time spent in each function. I just want an unrestricted frame rate and some way to see what it is. Is there a high precision counter that you can use on the iPhone? Something like QueryPerformanceCounter in windows?
Also, is there anyway for you to somehow KILL backround processes so you know they can't effect the performance, perhaps solving the sporatic frame rate problem?
Profile your app with Instruments and use the Core Animation instrument. It gives a frame rate.
You're taking the try-something-and-measure approach. Very indirect. It's easy to tell exactly what is taking the time; it doesn't depend on what else is going on and doesn't require learning a new tool. All you need is a debugger that you can interrupt.
You can't kill background processes on the iPhone. That would make it possible for a buggy or malicious app to interfere with the phone function and the needs of all other functions on the iPhone are subordinated to the phone.
Try QuartzDebug or OpenGL Profiler.
Use instruments to get the frame rate.
To do this, run profile on your app (click and hold on the run button in xcode and choose profile). Make sure you are running your app on device. Choose openGL ES analysis. Look at the data display under core animation frames per second.
You want to aim for 60fps.