Posts

Post not yet marked as solved
2 Replies
321 Views
Hi everyone. I'm developing a private app which can extract sensor data in a background timer. To run a timer in the background, I use a small trick: Enabling location update capability in background mode allows my timer to run backgrounded, and it actually works! My problem is: I choose 100Hz for my repeating timer fire interval in the background. However, the truth is sampling frequency is fluctuating. I've drawn a graph in my computer and the file is at test1.png - https://github.com/GeniusFKT/iOSSensor/blob/master/TimeIntervalTest/test1.png As you can see, when app is in the foreground, it works well. Then I switch it to the background, system spends a lot of time (about 1 second) to do the switching. Then when my app is in the background, the frequency starts to fluctuate in [10ms, 100ms] interval. But I hope my timer would run steadily in background too. Then I switch to foreground again, which works perfectly also. My question is: how can I run a timer steadily in a very big frequency(like 100Hz+)?
Posted
by GeniusFKT.
Last updated
.
Post not yet marked as solved
0 Replies
306 Views
Hello! I'm developing an app which related to sensor. I want to get sensor data continuously in foreground and even when I press home button, it should works in background. I use a timer to fetch data and put it in a runloop. How can I use BackgroundTasks to make it work? If it works, is there a time limit after I run my app in background, after this time maybe my app will be killed by system?Thanks
Posted
by GeniusFKT.
Last updated
.