Haptic Feedback for Cloud Games

Cloud Games now support haptic feedback. This feature is supported on Android devices when accessing a Cloud Game. The feedback type provided by Android on Cloud Games is similar to that provided on Instant Games:

  • The intensity of the vibration is set to the default value of the device: VibrationEffect.DEFAULT_AMPLITUDE.
  • The duration of the vibration is set to 100 milliseconds.

On an important note, due to the nature of Cloud Games, the amount of time it takes between the user triggering the haptic feedback and the device actually vibrating can be affected by the user’s connection to the server (latency), although this process is almost instantaneous on a usual basis.

API Documentation

performHapticFeedbackAsync()

Requests the user's device to perform a haptic feedback (making the device vibrate), triggered from within a Cloud Game. This API call will only work on devices with an integrated vibrator.

Parameters

  • context Context The application's current context.
  • callback DaemonRequest.Callback Callback function.

Examples

public void triggerHapticFeedback(@Nullable View view) {
  Context context = getApplicationContext();
  GameFeaturesLibrary.performHapticFeedbackAsync(context, null);
}

Returns void