×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2012.821 | Released: 23 May 2012, 2:01am | What's New | Download Now

system.vibrate()

Description:

Vibrates the phone. On the Corona simulator this will sound a system beep.

Syntax:

1
system.vibrate()

Example:

system.vibrate()  -- vibrate the device

Parameters:

None.

Returns:

Nothing.

Remarks:

To enable the vibrate function on Android devices, you must set the permission level in the build.settings file.

1
2
3
4
5
6
7
settings =
{
   androidPermissions =
   {
       "android.permission.VIBRATE"
   },
}

Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 1.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 1.0
  • Android:
    Corona SDK 2.0

Replies

Ninja Pig Studios's picture
Ninja Pig Studios
User offline. Last seen 10 hours 42 min ago. Offline
Joined: 26 Jan 2011

Anyone know how to make the vibrate function vibrate for a specific amount of time?

casper1
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 11 Jul 2011

How to enable in iOS? In Simulator bleep not works...

Tom
User offline. Last seen 11 hours 13 min ago. Offline
Staff
Joined: 13 Jul 2010

You didn't provide any details of what your are doing and what is not working but it is working in our release build, 591.

The vibrate generates a sound in the simulator and vibrates the phone. The Accelerator1 sample app demonstrates system.vibrate.

panicpop's picture
panicpop
User offline. Last seen 22 weeks 4 days ago. Offline
Joined: 8 Aug 2011

I used "system.vibrate()" on the latest 2011.591 build and when I put my app on my phone the app kept crashing at the point when it was supposed to vibrate. I went back removed the one line that had "system.vibrate()", put it back on my phone and the app doesn't crash anymore. Help???

Im using android 2.2 on my phone

andrebessa's picture
andrebessa
User offline. Last seen 1 week 1 day ago. Offline
Joined: 3 May 2011

Yes, to vibrate is giving malfunction. In the previous version to compile the same application, had no problem. Now generates the closing of the request.

rxmarccall's picture
rxmarccall
User offline. Last seen 4 days 20 hours ago. Offline
Joined: 18 Jan 2011

hey guys i had the same issue, but got it resolved, please see this forum post

http://developer.anscamobile.com/forum/2011/08/05/how-add-android-permission-build-file

basically you need to get permission from the phone to use the vibrate, see the post!

Tom
User offline. Last seen 11 hours 13 min ago. Offline
Staff
Joined: 13 Jul 2010

Sorry, but we did change something in Build 591 that would cause system.vibrate to stop working. We removed the Aandroid.permission.VIBRATE from the Android manifest. This means you must add this yourself to the build.settings file. I've update this API page with that information.

rxmarccall's picture
rxmarccall
User offline. Last seen 4 days 20 hours ago. Offline
Joined: 18 Jan 2011

Any way possible to decrease or increase the vibrate amount/size? having people complain that it vibrates too much haha