Support for background applications has two main components.
The first component is user control in the Leap application settings window. A user will always have the ability to prevent background applications from receiving data to prevent Leap-enabled applications from interfering with each other. Currently, you can allow or disallow background Leap applications using the Allow Background Apps checkbox in the Advanced section of the Settings window. This setting applies to all applications. In a future release, users will be able to set the background policy for individual applications.
The second component of the support for background applications is the new policy API. Any application that wants to receive frames of data in the background must set the Background Frames policy. You can set policy flags with the setPolicyFlags() method added to the Leap Controller class. Currently, the background frames policy is the only supported policy (but we may add additional policy settings in the future). You must set this policy every time your application launches in order to receive frames of tracking data while in the background.
Setting a policy is really a request. The request will not succeed if the Allow Background Apps setting is unchecked. In the future, a user can deny the request for individual apps. This means that the setPolicyFlags() function is asynchronous. If your application is not getting frames while in the background after setting the policy, you can call the Controller policyFlags() method to see if the request for background frames was successful.
In C++ you can request the background frames policy with the following statement:
controller.setPolicyFlags(Controller::POLICY_BACKGROUND_FRAMES);
In C#:
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
In Java:
controller.setPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
In Python:
controller.set_policy_flags(Leap.Controller.POLICY_BACKGROUND_FRAMES);
In Objective-C:
[controller setPolicyFlags:LEAP_POLICY_BACKGROUND_FRAMES];
The Airspace review will evaluate background apps for unintended interference with foreground software. Otherwise; we believe that users and developers should be free to experiment as they please.
Thanks!