AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones Sensor
  • Use conditions
  • Special cases
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Advertencia
A partir de la versión 27, SensorDetectEndBumps se conserva por motivos de compatibilidad. Esta función ha sido reemplazada por SensorDetectEndShake.
Notifies when the device has been shaken in any direction.
Ejemplo
// Detect the end of the shake gesture
SensorDetectEndShake("ProcShakeDetection")
// ProcShakeDetection procedure
PROCEDURE ProcShakeDetection(nDuration is int)
ToastDisplay(StringBuild("End of shaking. Duration: %1 thousandths of a second", nDuration))

// End of shake detection
SensorDetectEndShake("")
Sintaxis
<Result> = SensorDetectEndShake(<WLanguage procedure> [, <Sensitivity> [, <Shake beginning duration> [, <Interval>]]])
<Result>: Boolean
  • True if the detection of the end of the shake gesture was triggered,
  • False otherwise.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when device is no longer shaken. This procedure has the following format:
PROCEDURE <Procedure name>(<Duration>)
where <Duration> is an integer that corresponds to the duration of the shake gesture (in thousands of a second).
The parameters of this procedure are optional. There is no need to pass parameters to this procedure. Indeed, these parameters are automatically filled during each call
If the procedure name is an empty string (""), the shake end detection will be stopped.
<Sensitivity>: Optional integer or optional Integer constant
Indicates the level of sensitivity to shake gestures. Corresponds to:
  • value between 0 and 2000: 0 for very high sensitivity to shaking, 2000 for very low sensitivity to shaking.
  • one of the following constants:
    snrSensitivityHighHigh sensitivity to shake gestures. Even a low device shaking will trigger the notification.
    snrSensitivityLowLow sensitivity to shake gestures. Only a strong device shaking will trigger the notification.
    snrSensitivityNormal
    (Default value)
    Standard sensitivity to shake gestures
<Shake beginning duration>: Optional integer or optional Duration
Minimum duration (in thousands of a second) during which the device must be shaken before shake detection begins. By default, the minimum duration is set to 200 thousands of a second.
This parameter can correspond to:
  • an integer corresponding to the number of thousands of a second,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
<Interval>: Optional integer or optional Duration
Maximum time interval (in thousands of a second) during which the shake gestures can stay below the specified sensitivity level before triggering a shake end notification. By default, the maximum duration is set to 200 thousands of a second.
This duration can correspond to:
  • an integer corresponding to the number of thousands of a second,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Observaciones

Use conditions

  • The shake detection mechanism uses uses the accelerometer of the device. No shake detection will be performed if the device does not have this sensor. The sensitivity of the detection depends on the quality of the sensor in the device.

Special cases

  • If shake end and beginning detection (triggered by SensorDetectEndShake and SensorDetectBeginShake respectively) take place at the same time, the parameters (<Sensitivity>, <Shake beginning duration> and <Interval>) are the same in both cases. The values taken into account are the ones specified by the function called last.
  • We advise you to stop shake detection when it is no longer required in order to reduce battery consumption. To do so, <WLanguage procedure> must correspond to an empty string ("").
    SensorEnd is used to stop all the current detections.
Componente: WDJS.DLL
Versión mínima requerida
  • Versión 16
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local