My app is running in background mode because I'm playing and recording audio. I wish to find the device orientation while I'm recording. I set up notification that tells me when the orientation changes and it works fine while the app is active on screen.
My problem is that when I'm moving to background mode the notifications stop coming.
Is there a way to keep getting these notifications while my app is in background mode?
Thanks in advance.
You can check device orientation when your app resumes from background. UIApplicationDelegate protocol has several methods for handling app's transition from background to foreground; check this answer for nice writeup.
Related
Chirp audio QR frame work is not receiving data after resuming from background (This issue is only happening on iPAD devices iOS11+)
If the app is in foreground then framework works without having any issues, but if app goes background and then resuming this happens.
Joe from Chirp here. Are you stopping the SDK when moving to the background, and starting again in the foreground?
See our example project at https://github.com/chirp/chirp-ios-examples/blob/master/Swift/Messenger/ChirpMessenger/AppDelegate.swift for an example of this.
I have just tested this on an iPad running iOS 11.4.1 and data is still received when foregrounded.
I you want the app to receive/record audio when it goes into the background state, then Background Audio must be set in the Capabilities plist. Otherwise the OS will remove the microphone connection from your app's process (to allow the new foreground app to possibly use it).
My device is iPhone 5s running version 8.1.3. When any location based application runs in the background, the status bar becomes blue and big, thereby pushing my app's views down.
Is there any way that I could identify if any app run in the background and resize my view? Usually how is this handled?
Attached images.
Yes. Your app delegate can implement these methods:
-application:willChangeStatusBarFrame:
-application:didChangeStatusBarFrame:
and these local notifications will also be sent to the default notification center:
UIApplicationWillChangeStatusBarFrameNotification
UIApplicationDidChangeStatusBarFrameNotification
Can I check device brightness of iOS device's screen if application is in background state to see if the device is in use or not? If not, is there any other solution to check if device is in running state or in idle state?
No, if your app is backgrounded is suspended until an event wakes it up.
You can't monitor the behaviour of the phone from a backgrounded app.
You will not have control over the application when its in background state. you can monitor it only when your application is in active state.
I've developed Android app which has a background service in the sleep mode. This service works with accelerometer data and can launch the app from the sleep mode over the lock screen.
Is it possible to make the same on iOS?
I mean:
Create a service which can work in background with accelerometer data.
Service can launch the app when the phone is in the sleep mode over lock screen. (without unlocking)
If I'm not mistaken it must be possible on iOS7, isn't it?
Thanks!
Yes – Apple publicly stated background processing at WWDC keynote and it can be done to a degree on iOS6
No – Apple will 'probably' never allow an app to be opened without the user instigating it and certainly not over the lock screen.
You could use Push / Local Notifications which do appear on the lock screen to try and entice a user at a specific time to launch the app but no guarantees.
Is there a way to start the audio recording when the application is in background. It doesn't looks possible if we intend to hit app store. But since we are developing on Jailbreak device I wouldn't mind using any private frameworks or hacks.
Also anybody worked out how to prevent the red status bar while record is happening in the background.