Guest User

Untitled

a guest
Jan 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. public async void RequestLockScreenAccess()
  2. {
  3. var status = BackgroundExecutionManager.GetAccessStatus();
  4. if (status == BackgroundAccessStatus.Unspecified || status == BackgroundAccessStatus.Denied)
  5. status = await BackgroundExecutionManager.RequestAccessAsync();
  6. switch (status)
  7. {
  8. case BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity:
  9. _mainInfo.NotifyUser = "This app is on the lock screen and has access to Always-On Real Time Connectivity.";
  10. break;
  11. case BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity:
  12. _mainInfo.NotifyUser = "This app is on the lock screen and has access to Active Real Time Connectivity.";
  13. break;
  14. case BackgroundAccessStatus.Denied:
  15. _mainInfo.NotifyUser = "This app is not on the lock screen.";
  16. break;
  17. case BackgroundAccessStatus.Unspecified:
  18. _mainInfo.NotifyUser = "The user has not yet taken any action. This is the default setting and the app is not on the lock screen.";
  19. break;
  20. }
  21. }
  22.  
  23. status = await BackgroundExecutionManager.RequestAccessAsync();
Add Comment
Please, Sign In to add comment