Android Question vibration enabled

Discussion in 'Android Questions' started by hookshy, May 3, 2015.

Similar threads

B4A Tutorial Google Maps
B4A Tutorial android.jar / targetSdkVersion / minSdkVersion
B4A Code Snippet Version safe notification
B4A Tutorial Integrating Firebase Services
B4A Library ToggleLibrary
  1. hookshy

    hookshy Well-Known Member Licensed User

    Q: Is there a way to detect if the vibration is turned off by the user or not supported ?

    Thank you
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    On Android 4+ you can use this code to check whether this feature is available:
    Code:
    Private Sub HasVibrator As Boolean
       
    Dim jo As JavaObject
       jo.InitializeContext
       
    Dim p As Phone
       
    If p.SdkVersion < 12 Then Return True
       
    Return jo.RunMethodJO("getSystemService"Array("vibrator")).RunMethod("hasVibrator"Null)
    End Sub
     
    hookshy likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice