Vibration pattern does not play correctly

50 Views Asked by At

I'm working on an android app that allows to change the default vibration for an incoming call. Since there is no direct path, I have to perform something like the following algorithm on an incoming call:

  1. Save the current sound mode
  2. Switch to silent mode to turn off the standard vibration
  3. Start playing my vibro pattern
  4. Restore sound mode when call ends In general, this algorithm works great. But on some device models, I observe incorrect playback of the vibration pattern while an incoming call is in progress. If it plays during an incoming call, the length of each vibration will be greatly shortened. In this case, all pauses are preserved.

For example, I have a pattern: {0, 200, 500, 300, 500, 400}. This means:

  • 0ms start delay
  • 200ms vibration
  • 500ms pause
  • 300ms vibration
  • 500ms pause
  • 400ms vibration But, when it plays during incoming call, sounds like:
  • 0ms start delay
  • 20ms vibration
  • 500ms pause
  • 20ms vibration
  • 500ms pause
  • 20ms vibration Yes, I know, most likely I got into vendor-specific things. But still... Maybe someone has already encountered this and knows how to get around it? Thanks a lot!
0

There are 0 best solutions below