BackgroundExecutionManager.RequestAccessAsync | requestAccessAsync Methods

Présente à l'utilisateur une boîte de dialogue demandant qu'une application soit ajoutée à l'écran de verrouillage.

Liste de surcharges

MéthodeDescription
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.

Exemples

Cet exemple illustre cette méthode lorsqu'elle est utilisée pour ajouter une application à l'écran de verrouillage.


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;
        }
    });

Conditions requises

Client minimal pris en charge

Windows 8

Serveur minimal pris en charge

Windows Server 2012

Espace de noms

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

Métadonnées

Windows.winmd

Voir aussi

BackgroundExecutionManager

 

 

Afficher:
© 2015 Microsoft