AathifMahir.Maui.MauiShakeDetector 0.1.0-preview1

Prefix Reserved
This is a prerelease version of AathifMahir.Maui.MauiShakeDetector.
There is a newer version of this package available.
See the version list below for details.
dotnet add package AathifMahir.Maui.MauiShakeDetector --version 0.1.0-preview1                
NuGet\Install-Package AathifMahir.Maui.MauiShakeDetector -Version 0.1.0-preview1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AathifMahir.Maui.MauiShakeDetector" Version="0.1.0-preview1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AathifMahir.Maui.MauiShakeDetector --version 0.1.0-preview1                
#r "nuget: AathifMahir.Maui.MauiShakeDetector, 0.1.0-preview1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AathifMahir.Maui.MauiShakeDetector as a Cake Addin
#addin nuget:?package=AathifMahir.Maui.MauiShakeDetector&version=0.1.0-preview1&prerelease

// Install AathifMahir.Maui.MauiShakeDetector as a Cake Tool
#tool nuget:?package=AathifMahir.Maui.MauiShakeDetector&version=0.1.0-preview1&prerelease                

Maui Shake Detector

Maui Shake Detector is Shake Event Detector Library Which Detects Shake Event from Android, iOS and etc. with Options to Customize the Shake Gforce and Shake Intervals and Haptics and Haptics Duration and etc.

Permission

In order to use Maui Shake Detector, You need to Specific permission to Android

Android

Add the assembly-based permission:

Open the Platforms/Android/MainApplication.cs file and add the following assembly attributes after using directives:

C#


[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]

  • or -

Update the Android Manifest:

Open the Platforms/Android/AndroidManifest.xml file and add the following in the manifest node:


<uses-permission android:name="android.permission.VIBRATE" />

Get Started

using MauiShakeDetector;

    // Start
    private void BtnStartListening_Clicked(object sender, EventArgs e)
    {
        if (ShakeDetector.Default.IsSupported && !ShakeDetector.Default.IsMonitoring)
        {
            ShakeDetector.Default.StartListening();
            ShakeDetector.Default.ShakeDetected += Detector_ShakeDetected;
            return;
        }
    }

    // Stop
    private void BtnStopListening_Clicked(object sender, EventArgs e)
    {
        if (ShakeDetector.Default.IsMonitoring)
        {
            ShakeDetector.Default.StopListening();
            ShakeDetector.Default.ShakeDetected -= Detector_ShakeDetected;
        }
    }

    private void Detector_ShakeDetected(object sender, ShakeDetectedEventArgs e)
    {
        Debug.Writeline($"No of Shakes : {e.NoOfShakes}");
    }

Parameters

Parameters Type Description
IsSupported bool Indicating Whether ShakeDetector is Supported on this Device
IsMonitoring bool Indicating Whether ShakeDetector is Already Monitoring
IsHapticsSupported bool Indicating Whether Haptics Supported in this Device
IsHapticsEnabled bool Indicating Whether Haptics is Enabled
ShakeThresholdGravity double Get or Set the Value of Shake Detection Threshold
ShakeIntervalInMilliseconds TimeSpan Get or Set the value of Minimum Delay betweem Shakes
ShakeResetIntervalInMilliseconds TimeSpan Get or Set the Value of Shake Reset Interval in Milliseconds
MinimumShakeCount int Get or Set the Value for Number of Shakes Required Before Shake is Triggered
HapticsDurationInMilliseconds TimeSpan Get or Set the Value Of Haptics Duration
ShakeDetected event Shake Detected Event for Detecting Whether User Shaked the Device
StartListening() method Start listening for Shake Event
StopListening() method Stop Already Monitoring Shake Event

License

Maui Shake Detector is Licensed Under MIT License.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-android33.0 is compatible.  net7.0-ios was computed.  net7.0-ios16.1 is compatible.  net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 is compatible.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net7.0-windows10.0.19041 is compatible.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net7.0-android33.0

    • No dependencies.
  • net7.0-ios16.1

    • No dependencies.
  • net7.0-maccatalyst16.1

    • No dependencies.
  • net7.0-windows10.0.19041

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 336 11/19/2023
1.0.0 163 9/13/2023
0.4.0 186 6/3/2023
0.3.0 174 5/24/2023
0.2.0 157 5/19/2023
0.1.0 163 5/15/2023
0.1.0-preview1 125 5/13/2023

v0.1.0-preview1
• First Preview Build