Jump to content

Vibration API


Recommended Posts

I am trying to use the vibration API on android phone but it's not working - seems there is something I'm not doing right

I have tried the code below, but none is working.  Is there a way to create vibration using SMS code without cordova plugin?

 

asm

  navigator.vibrate(500);

end;

 

and

 

asm

  window.navigator.vibrate([500]);

end;

 

and


 

asm

function vib() {
  navigator.vibrate([500]);
}
vib();

end;

Link to post
Share on other sites
  • 2 weeks later...

Thanks. It finally worked!

When working with mobile browser, this code will work

browserapi.window.navigator.vibrate(200);

But when web app is run inside android app, it's easier to use a  Cordova plugin then change code to 

asm

    navigator.vibrate(200);

end;

And set permissions in config.xml > android.permission.VIBRATE

 


 
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...