system.vibrate() causes crash

I am using the Corona SDK on a Windows Machine and tested on an Incredible running Android 2.2.1.

In the Simulator, system.vibrate() does nothing. The documentation says it should beep.

On the phone, system.vibrate() causes the app to crash immediately.

Any advice?

Did you remember to include the correct Android permission for your device? You need android.permission.VIBRATE in your build.settings
http://developer.anscamobile.com/content/configuring-projects#Application_Permissions_Android

Snarla,

1. Thanks a lot (re: very much) for your response, I had not considered this page and will review

2. I was under the impression Vibrate was a permission Corona Apps requested by default (?)

3. Should it really crash if Vibrate permission is not granted? Any way to check first via code if vibrating is a-ok? What if the user denies vibrate permission to their apps via Android, will my app still crash then? If so I would consider this a bug.

I have added a build.settings file with android.permission.VIBRATE included, and it still does not beep when called in Simulator, as the documentation says it should.

The Android permission is so that it does not crash on Android device.
The not producing sound on Windows Simulator is a bug, thanks for reporting it!

could you please post an example code of your build file? im having the same issue, but when i add android.permission.VIBRATE to my build file it screws up the orientation of my game, i have it setup to play horizontally

this is what i have:

1
2
3
4
5
6
7
8
9
10
11
12
13
android.permission.VIBRATE
 
settings =
{
        orientation =
        {
                default = "landscapeRight",
                supported =
                {
                "landscapeLeft", "landscapeRight"
                }
        }
}

"android.permission.VIBRATE"
What about iOS?

No need to set permissions for iOS in order to allow vibration - or any other permission...

views:2033 update:2011/9/27 18:14:54
corona forums © 2003-2011