BackgroundExecutionManager.RequestAccessAsync | requestAccessAsync methods

0 out of 1 rated this helpful - Rate this topic
Presents the user with a dialog box that requests that an app be added to the lock screen.

Overload list

MethodDescription
RequestAccessAsync() Presents the user with a dialog box that requests that the calling app be added to the lock screen.
RequestAccessAsync(String) Presents the user with a dialog box that requests that the specified app be added to the lock screen.

Examples

This example shows this method used to add an app to the lock screen.


var Background = Windows.ApplicationModel.Background;

var promise = Background.BackgroundExecutionManager.requestAccessAsync().then(
    function(result) {
        switch (result) {
            case Background.BackgroundAccessStatus.denied:
                // Background activity and updates for this app are disabled by the user. 
                break;
    
            case Background.BackgroundAccessStatus.allowedWithAlwaysOnRealTimeConnectivity:
                // Added to list of background apps.
                // Set up background tasks; can use the network connectivity broker.
                break;
    
            case Background.BackgroundAccessStatus.allowedMayUseActiveRealTimeConnectivity:
                // Added to list of background apps.
                // Set up background tasks; cannot use the network connectivity broker.
                break;
    
            case Background.BackgroundAccessStatus.unspecified:
                // The user didn't explicitly disable or enable access and updates. 
                break;
        }
    });

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Namespace

Windows.ApplicationModel.Background
Windows::ApplicationModel::Background [C++]

Metadata

Windows.winmd

See also

BackgroundExecutionManager

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.