From: Tomasz Marciniak Date: Wed, 5 Apr 2017 11:43:08 +0000 (+0200) Subject: [HAM] Added guide for gesture recognition X-Git-Tag: GitHub/PR#40/tizen-studio~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e53f52f57e9fd89742c3d49aaede2f3e0e55527;p=sdk%2Fonline-doc.git [HAM] Added guide for gesture recognition PS4: Reviewed Change-Id: I5c601e6ee148573106acb443469723f5736b950e Signed-off-by: Tomasz Marciniak --- diff --git a/org.tizen.guides/html/index.htm b/org.tizen.guides/html/index.htm index cfeec8b..6e0b33b 100644 --- a/org.tizen.guides/html/index.htm +++ b/org.tizen.guides/html/index.htm @@ -661,6 +661,7 @@
  • Task: Sensor Ball
  • +
  • Gesture Recognition
  • Text Input diff --git a/org.tizen.guides/html/web/sensors/ham_gesture_w.htm b/org.tizen.guides/html/web/sensors/ham_gesture_w.htm new file mode 100644 index 0000000..8d9a2ee --- /dev/null +++ b/org.tizen.guides/html/web/sensors/ham_gesture_w.htm @@ -0,0 +1,138 @@ + + + + + + + + + + + + + Gesture Recognition + + + +
    +
    +

    Mobile Web Wearable Web

    +
    + +
    +

    Dependencies

    +
      +
    • Tizen 4.0 and Higher for Mobile
    • +
    • Tizen 4.0 and Higher for Wearable
    • +
    +

    Content

    + +

    Related Info

    + +
    +
    + +
    +

    Gesture Recogniton

    + +

    You can set your application to recognize specific user gestures and react when the user performs them. The various recognizable gestures include, for example, when the user taps, shakes up, or picks up the device, or moves it along an axis.

    +

    This feature is supported in mobile and wearable applications only.

    +

    The main gesture recognition features of the Human Activity Monitor API include:

    + + + +

    Checking the Gesture Support

    +

    Some gestures are not supported on all devices because the devices lack the necessary sensors.

    +

    To check whether a specific gesture type is supported on the current device, use the isGestureSupported() method of the HumanActivityMonitorManager interface (in mobile and wearable applications):

    + +
    +try
    +{
    +   var isSupported = tizen.humanactivitymonitor.isGestureSupported("GESTURE_PICK_UP");
    +   console.log("GESTURE_PICK_UP is " + (isSupported ? "supported" : "not supported"));
    +}
    +catch (error)
    +{
    +   console.log("Error " + error.name + ": " + error.message);
    +}
    +
    + +

    Receiving Notifications on Recognized Gestures

    + +

    Learning how to register a listener for gesture recognition allows you to receive notifications about different gestures the user performs with a device:

    +
      +
    1. To register a listener, use the addGestureRecognitionListener() method of the HumanActivityMonitorManager interface (in mobile and wearable applications): +
      +var listenerId;
      +
      +function listener(data)
      +{
      +   console.log("Received " + data.event + " event on " + new Date(data.timestamp * 1000) + " for "+ data.type + " type");
      +}
      +
      +function errorCallback(error)
      +{
      +   console.log(error.name + ": " + error.message);
      +}
      +
      +try
      +{
      +   listenerId = tizen.humanactivitymonitor.addGestureRecognitionListener("GESTURE_SHAKE", listener, errorCallback);
      +}
      +catch (error)
      +{
      +   console.log("Error " + error.name + ": " + error.message);
      +}
      +
      +
    2. + +
    3. To stop receiving the notifications, remove the listener using the removeGestureRecognitionListener() method of the HumanActivityMonitorManager interface with the listener ID: + +
      +try
      +{
      +   tizen.humanactivitymonitor.removeGestureRecognitionListener(listenerId);
      +}
      +catch (err)
      +{
      +   console.log("Exception: " + err.name);
      +}
      +
      +
    4. +
    + + + + +
    + +Go to top + + + + + + + diff --git a/org.tizen.guides/html/web/sensors/sensors_cover_w.htm b/org.tizen.guides/html/web/sensors/sensors_cover_w.htm index f42328e..a44ff99 100644 --- a/org.tizen.guides/html/web/sensors/sensors_cover_w.htm +++ b/org.tizen.guides/html/web/sensors/sensors_cover_w.htm @@ -43,6 +43,9 @@
  • Device Sensors

    You can read and manage data from various sensors on the device, and also receive notifications when the sensor data changes. You can access information from various environmental sensors, such as the light and magnetic sensors, and from user-related sensors, such as the heart rate monitor.

  • + +
  • Gesture Recognition +

    You can retrieve information about recognized gestures that the user performs with a device.

  • diff --git a/org.tizen.guides/index.xml b/org.tizen.guides/index.xml index baee6a3..e6bfa1e 100644 --- a/org.tizen.guides/index.xml +++ b/org.tizen.guides/index.xml @@ -469,6 +469,7 @@ +