Why does lag only stop after reboot? - memory

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.

Related

Keep iOS App Awake To Monitor Movement

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.

iOS keep app always alive for home automation purpose

I'm building home automation system for my house.
The plan is to have lots of different rfduino nodes talking to one wall mounted iPad through the bluetooth.
So far all working perfect apart from keeping an app alive all the time, device is plugged to the charger.
My question is rather simple and I struggle to find a solution.
How can I keep the app always alive to do its processing but with the screen disabled?
Thanks in advance

Can an app keep running while the screen is locked, on a jailbroken iphone?

I have an idea for an app that I'd like to develop, but before I invest a lot of time learning objective C and the iOS APIs, I'd like to make sure that what I want to do is feasible.
The app I want to make is a purely auditory (sound-only) version of Google Glass. I'm visually impaired, so spending a lot of money on something visual, even though it can read content to you, would not be worth it. But if I could use an iPhone to give many of the same options as Google Glass, that would be great.
Many times, I've wanted a piece of information while walking down the street, where I couldn't easily get to my iPhone, because I have my cane in one hand, and something else in the other. In such cases, it'd be awesome if I could say a command, and get a voice response.
I'd use the microphone built into the Apple earphones for audio input, but I'm not sure if it's possible to listen for audio input while the screen is locked. I'm certain it's not possible with a non-jailbroken iPhone.
Can anyone can tell me if this is possible?
Yes, you can do this.
In order to keep your app running all the time, even when the iPhone is locked, you could build a Launch Daemon. A launch daemon can start when the phone does, and is not subject to the restrictions that iOS puts on sandboxed apps, installed to /var/mobile/Applications/.
You do need to have a jailbroken device to take advantage of Launch Daemons. Here is a good tutorial on building one.
Launch Daemons are also a normal part of OS X, so if you need more information, you might try consulting the OS X docs online. Most aspects of Launch Daemons work the same way on a jailbroken iPhone.
You'll also want to be able to detect certain events, to activate your app. You certainly don't want to be processing an audio stream at all times (maybe you only activate the app when you start walking with your cane). To detect events, like a home button press (or however you want to activate your code), I would take a look at RPetrich's libactivator library.

iOS - i receive memory warnings but have no idea why

I am developing for the iOS and checking my app with IPhone and IPad.
I receive many memory warnings (didReceiveMemoryWarning is called) but have no idea why.
My app is using ~35MB in the peak points, and 4-5 MB when it the lowest point.
I tried to find leaks using 'instruments' but could not find any critical issues.
Is there a good way to find out why the system sends memory warnings?
Memory warning is to be expected in an iOS app. It doesn't have to be because of your app. Other apps are still in memory even if the apps are suspended. The OS will do memory management by sending memory warning and kill apps when necessary. As long as you're using reasonable amount of memory (with little to no memory leak) and handle didReceiveMemoryWarning properly, you'll be fine.
Also, when your app is in suspended mode, if your app is using little memory footprint, your app will more likely to survive killing process. As app with larger memory footprint will be terminated first.
I also found that "Product -> Analyze" (Shift+Command+B) can help you sort out some code issues before you start using Leaks. With the introduction of ARC this became less useful though.

Best way to benchmark iPhone app's battery usage?

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)

Resources