I recently decided to provide haptic feedback for the buttons in my app. I looked up how to get the Vibrator from the activity and arranged for my button object to call vibrate().
Truth be told, the first time around, I had in fact forgotten to set the permission android.permission.VIB开发者_高级运维RATE, but I quickly put that into the manifest once the exception was thrown.
The problem is that the app continues to throw a security exception claiming the app does not have the VIBRATE permission. I've uninstalled the app on the test phone. I've done a clean build of the project, even restarted Eclipse just for giggles, but nothing makes this exception go away.
Can anyone think of a reason why this would happen?
The only time this has ever happened to me, it was due to Eclipse creating bad APKs. Maybe try deleting your bin folder entirely and then rebuild?
Also, I double check your manifest to be absolutely sure you spelled the permission properly.
Are you sure you used <uses-permission android:name="android.permission.VIBRATE"/>
and not just <uses-permission name="android.permission.VIBRATE"/>
?
精彩评论