Keep iOS App Awake To Monitor Movement - ios

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.

Related

Xcode stuck with loading wheel after adding Apple Watch Extension

I have recently added an Apple Watch App and Extension to my app. Since then my Xcode regularly (every 2-3minutes) freezes with the colored loading indicaton for about 10 seconds.
This is extremely annoying and I cannot find any indication as to why it is happening. It just gets stuck when looking at source code or scrolling.
Did anyone experience a similar issues after integrating Apple Watch and knows how to solve this? I have a feeling it could be related to trying to connect to the Apple Watch, as I have setup wireless debugging for my phone.
Unfortunately this is just an expected behavior when doing wireless debugging with an Apple Watch. Developing for watchOS can be fun, but you’ll have to pack a good amount of patience. In my own experience I’ve had to deal with randomly cut off connections, Xcode freezing, and all sorts of instability. You may have better luck with the watchOS simulator, if it can satisfy your use case.

BLE device- same code and same firmware works well with iphone SE and works not as good in iphone 7 plus

I am working with ibeacon. I created an application for tracking devices. But I am facing a problem with the application. The app works well in the terminated state for iPhone SE whereas it is not working (in the locked state) for iPhone 7+.In the unlocked state it is working for 7+ also but still it is very slow compared to iPhone SE. Is there any specific reason for this problem. If it can be solved, what could be the possible solution to this problem.
I am really helpless and clueless about this issue.Please do help me and assist me with your knowledge Sir. Thank you in advance.
When an iOS app is in the background, it relies on two different mechanisms to detect beacons:
Hardware filters. These are byte patterns stored on the Bluetooth chip that alert the OS when a BLE advertising packet is received that matches your beacon region. This mechanism is very fast and delivers results within a second, but it is a limited resource. Once all slots are full, it will no longer work. There is no documentation about the number of slots available on each iPhone model, but experiments suggest the number is ~30.
Software scans. A full BLE scan is performed to find all beacons even if they are not stored in a hardware filter. In the foreground with ranging active, software scans are constant. In the background they are periodic to save battery, so detections based on software scans are much slower. The rate is undocumented, but experiments suggest software scans are performed every ~10 minutes in the background in the typical phone state. An additiona softwarel scan is also performed when the screen is unlocked.
The problem description is consistent with hardware filters (1) not working on the iPhone 7+. This may not be a problem with the phone model, it could be a problem with the specific device, or more likely the software state on the phone. A typical cause is the installation of multiple beacon apps that use up all the slots. Each beacon app can register up to 20 beacon regions for monitoring, so just two apps could use up all the slots!. The first apps to run and register slots may hold them forever.
A few troubleshooting tips:
Uninstall any other apps you think may. be detecting beacons, then re-install yours.
Restart your device.
If the above does not help, you may have a hardware problem with your device. Try another iPhone 7+ to see if you can reproduce.

Can we open an App in iOS using voice?

Basically I would like to turn on my app when in a certain environment(club scene), can an app be turned on in iOS using an algorithm?
Regards,
Feras A.
iOS is not in favor of keeping the mic open all the time to record everything. So I dont see this is possible anytime soon.
You have to have an app that records the voice all the time and does a lot of FFT in order to determine what kind of scene you are in.
Unless your app is a music streaming app unfortunately app will be suspended by OS sooner or later so you cannot listen all the time.

iPad Kiosk application // Guided Access and empty Battery

We want to use iPads with iOS7 for an POS/Kiosk application. We use the guided access mode to restrict the customers to one app. The store will shut down the power during weekends, so the iPads will run out of battery. This raises several questions:
Is there a way to send an ipad to sleep mode and awake them programmatically? So that the iPad battery might last a complete weekend without power?
What will happen when the power resumes, if the ipad blacked out?
Will the last run app be resumed in guided access mode?
Any help is appreciated! Thanks for your help!
Chris
Don't disable access to the hardware buttons. I've never had problems with people turning off the device during the business day.
Alright, after quite some time I can give an update on this. The way we used in the end was a MDM solution (mobile device management). We had less then 100 devices to manage, so we use the free version of meraki (https://meraki.cisco.com/). Which is an awesome tool. With Meraki you are able to remotely to install certificates, that lock the iPad completely.
In a way, that if you don't have Wifi / Internet on the iPads, you cannot remove the lock, without resetting the iPad completely.
Coming back to the original question, the iPads run on battery until they die in the morning. And they are charged throughout the day. So it's a complete load / discharge cycle everyday. Since there is no way of changing this, we stopped to deploy iPads for POS in-store projects and switched to Android devices like without battery.
Hope this helps someone!

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.

Resources