IOS background

I have a question about running an application in the background. I know how to do it, but Apple doesn't like the way I do it.

To get you on one page, I have a security app and I need to keep track of it, even if it is in the background. This is like a burglar alarm. I used the background audio mode, thinking that everything will be fine, because I will play the sound when it works. Needless to say, Apple didn't like it. So I added ping! It works in active mode and then plays background sound in background. And again they didn’t like it either.

My application also controls the accelerometer (but not always, only when selected by the user).

My question is, how can apps like Skype and other similar apps turn on the red status bar and stay in the background? (Even some emergency applications will do this without reproducing either sound or anything.)

Also, I cannot use the notification system, because it does not update fast enough if I control the battery level. For my application, I need an immediate response.

I also searched tirelessly for this answer before posting my question (the answers I found do not work for me ..): (

I am very grateful for your understanding, thanks in advance!

(If you need more information, ask!)

+6
ios background monitor mode
source share
3 answers

From what I can tell from their documentation, it seems that the only way to maintain a constant background connection is to use one of my seven background mode keys , which I see that you have tried since you registered for background sound. I also know some emergency applications that use this feature (such as a sleep cycle), and I believe that they also use background audio mode, given that the other six modes are not remotely close to what they need.

I think that Apple’s reasoning may be that these applications are allowed to do this because their application is intended to be used when the user is not using the phone actively (i.e. when he is sleeping) and requires the user to wake the sound, then as if you use a secure application that wants to be active at all times, it can interfere with other functions that the user can use, for example, in Skype. The red bar will also be stored in the upper part of the device at any time when the user uses it, which they might mistake for what is still playing, because usually when the red bar appears, it means that the user is still actively using something . Again, I think that applications for the alarm clock and others like them that do not use constant sound can get away from this, since they are intended to be used when the phone is inactive, therefore with a constant red bar when the application is not visible - it is not problem.

In some other cases, such as Nike + (discussed here ) and probable pedometers, they seem to use the background location mode, as they often also keep track of where you went and need to know the distance. In this discussion with which I am associated, it seems that others have been able to get accelerometer updates by registering for use in the background. Have you tried registering to move your location? One drawback I can see is that it can reduce battery life faster, but if you check the location infrequently, it might not be so bad? The other is that I don’t think you can directly play audio in the background, but can you try to trigger a sound notification? :) This might be a good workaround for it if it works for your application.

Again, my arguments for why these applications can do this are based only on how I saw how other applications work, and Apple may have different reasons why they accept them, but that was my best way of thinking why your application is rejected to use these modes, while others may do so. If the location is not what you are looking for, unfortunately, I’m not sure what your application seems like to be able to constantly work in the background as you expect.

+5
source share

You can use background modes only if you actively use activity that supports the awakening of the application: for example. continuous sound reproduction is the correct use of background sound. They will be pretty hard to see if you really need the access that you are requesting, and if they do not reject you (as you already found out), because the background services drain the battery much more than others.

From the docs :

These keys should be used sparingly and only by applications that provide these services.

Story: I think you're out of luck with the implementation you proposed.

0
source share

Being responsive is a must for every application. Users want apps that are ready to open content when they open it, so developers should use background modes to make their apps more user-friendly.

Enabling Background Features

  1. Go to Xcode and open your project.
  2. In the destination application, go to the Features tab.
  3. Turn on background modes.

Background sketch

Background Sampling is a new mode that allows your application to always be up to date with the latest data and minimize battery impact. You can load channels at fixed intervals with this feature.

To start:

1- Check the Background Fetch on the features screen in Xcode.

2- In the application (method _: didFinishLaunchingWithOptions :) in AppDelegate,

Link: https://medium.com/@javedmultani16/background-modes-in-ios-3da25b9e6474

0
source share

All Articles