Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async void RequestLockScreenAccess()
- {
- var status = BackgroundExecutionManager.GetAccessStatus();
- if (status == BackgroundAccessStatus.Unspecified || status == BackgroundAccessStatus.Denied)
- status = await BackgroundExecutionManager.RequestAccessAsync();
- switch (status)
- {
- case BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity:
- _mainInfo.NotifyUser = "This app is on the lock screen and has access to Always-On Real Time Connectivity.";
- break;
- case BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity:
- _mainInfo.NotifyUser = "This app is on the lock screen and has access to Active Real Time Connectivity.";
- break;
- case BackgroundAccessStatus.Denied:
- _mainInfo.NotifyUser = "This app is not on the lock screen.";
- break;
- case BackgroundAccessStatus.Unspecified:
- _mainInfo.NotifyUser = "The user has not yet taken any action. This is the default setting and the app is not on the lock screen.";
- break;
- }
- }
- status = await BackgroundExecutionManager.RequestAccessAsync();
Add Comment
Please, Sign In to add comment