Skip to content

Commit

Permalink
Added permission check to vibration functions (#292)
Browse files Browse the repository at this point in the history
* Added permission check to vibration functions

* Update VibrationService.cs

Co-authored-by: Erling Moxnes Kristiansen <emk@dips.no>
  • Loading branch information
ErlingMK and Erling Moxnes Kristiansen authored Sep 27, 2021
1 parent aae5ed0 commit d030c82
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/DIPS.Xamarin.UI.Android/VibrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ internal static void Initialize(Activity activity)

private static bool ShouldVibrate()
{
if (s_hasPermission == Permission.Denied)
{
return false;
}

s_vibrator ??= Vibrator.FromContext(s_activity);
return true;
}
Expand Down

0 comments on commit d030c82

Please sign in to comment.