I'm building an alarm clock that allows the user to play a continuous sound at a specific fire date while the app is in the foreground and the screen is locked.
https://github.com/mruegenberg/MMPDeepSleepPreventer is the only solution I've found to prevent my app from exiting after 10 minutes. However, this approach is causing significant battery drain.
Are there any other approaches to this problem without draining the battery significantly? I know it is possible because there are other alarm clocks out there that do this without killing the battery and without jailbreak.
Related
When playing games on my phone for an hour the phone starts lagging quite a bit. Nothing I do takes away the lag except restarting the device. I have tried some memory cleaning apps on the playstore, I have tried cleaning all running apps, and I have tried apps that 'simulate' a reboot.
I also checked online and there are no adb commands that clear the RAM (I don't want to clear the game cache).
I am trying to find a way to stop my phone's lag the same way restarting it does, but there seems to be no info online at all. So what is happening when the phone is rebooting that cannot be done with software alone? If it is because the memory is being cleaned, why are there no apps that work?
This could be due to a lot of reasons, one of the main ones being thermal limits. Once you have been playing for a while, your phone might have to throttle it's performance to maintain a temperature safe for the SoC inside. I will say however, that cluttering your phone and background processes with a lot of these "memory cleaning" apps probably isn't helpful. If you are on android, there is a built in optimization widget (on new-ish devices) that you can free up ram and storage with.
I've developed an iOS app that connects to a BLE peripheral and retrieves heart rate data of one person during the night.
The app runs on the foreground and also on background using Bluetooth accessories background mode.
It receives heart rate data every second and appends it into a file, in order to save a report for the whole night.
The app is working fine in some devices (it writes data during the whole night), but in other devices (tested an iPhone 5s) it relaunches automatically every 1.5 or 2 hours. I found that sometimes iOS kills background apps due to memory pressure, so I made some memory tests with the profiler, but the app only consumes 8MB, and it never gets more than that, so there is no memory issue.
It is really important for me to prevent the app suspending, so I can detect any possible anomaly on the heart rate and trigger an alert.
Any clue on this?
I'm having trouble getting the main feature of my iOS application to work. I'm trying to create an app that measures the amount of movement over a period of a few hours using CoreMotion. All works fine when the device is awake, however the issue is that the device auto locks after a while and enters the background state, thus my methods for monitoring movement pause.
I'm searching for a possible solution to recording the device's movement whilst it has been locked, which may be to keep the app awake for a few hours at a time. I've looked into a bunch of possible solutions that have been used for this in the past, yet found out that these ways of doing it can now cause the app to be rejected by Apple.
Any help would be much appreciated please.
For anyone who is interested or stuck on a similar problem I figured out the solution to my question. I needed to utilise the iPhone's motion coprocessor, which tracks movement overtime and stores this data on the device. This is part of the CoreMotion framework and can be queried regardless of whether the application was open or not at the time of use. It's also worth mentioning that only the iPhone 5s and later have this hardware, so older devices will no be able to take advantage of this.
I hope this helps anyone who needs it.
I am looking forward to submitting an iPad application which uses CoreAnimation a lot and so it's heavy.
In "App Store Review Guideline", it shows:
13.2 Apps that rapidly drain the device's battery or generate excessive heat will be rejected
While working my application on real iPad, it drains the battery to half in 4 hours, let the device to become a little bit warm. Will this be a reason enough to be rejected?
What's the best way to benchmark an iPhone app's battery usage?
I'm working on an iPhone app that uses location services and runs in the background. It seems like the battery drains significantly faster with it running, but when I try to do some structured tests, the results are inconclusive.
The steps I'm taking are:
charge the battery to 100%
remove the SIM (I need it for my other phone)
turn off push for mail/calendar/contacts
reinstall the app
restart the phone
start the app
return to SpringBoard (the app selection screen)
I then wait for about 15 hours and see what the battery is at. The results so far are:
App not running - 69% left
App running - 65% left
App running - 83% left
Turns out the answer is to use Apple's Measure Energy Impact in Xcode.
The info it provides really helped track down what was causing our battery draining issue.
In retrospect, I should have said that I was completely new to iOS, and was not a developer (working on the app as QA).
Doesn't that just tell you that there's not a high correlation between battery usage and your app running? It looks like there's something else that's causing battery drain?
(Watch out though, that something else might be the number of gps satellites passing at the time - the faster it gets GPS, the less battery usage your app will consume - you might have to take a look at how much time your app actually spends running vs sleeping for each test)