/// <summary>Checks and asks user for sufficient permissions for WIFI</summary> /// <returns>true if ok to continue, otherwise false</returns> public async Task <bool> ChkWifiPermissions() { try { await this.SetAreGranted(false); ILocationWhileInUsePermission wifiPermissions = DependencyService.Get <ILocationWhileInUsePermission>(); PermissionStatus status = await wifiPermissions.CheckStatusAsync(); if (status != PermissionStatus.Granted) { status = await wifiPermissions.RequestAsync(); if (status != PermissionStatus.Granted) { return(await this.GetIsGranted()); } } await this.SetAreGranted(true); } catch (Exception e) { this.log.Exception(9999, "", e); await this.SetAreGranted(false); } return(await this.GetIsGranted()); }
/// <summary>Abort the App if Wifi permissions not enabled</summary> /// <returns>true if permissions granted, otherwise false</returns> private async Task <bool> CheckPermissions() { ILocationWhileInUsePermission wifiPermissions = DependencyService.Get <ILocationWhileInUsePermission>(); PermissionStatus status = await wifiPermissions.CheckStatusAsync(); if (status != PermissionStatus.Granted) { status = await wifiPermissions.RequestAsync(); } return(status == PermissionStatus.Granted); }