[Bug] java.lang.SecurityException: Requires VIBRATE permission
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment:
OS: macOS Sierra 10.12.6 Node: 8.4.0 Yarn: 1.3.2 npm: 5.5.1 Watchman: 4.9.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: ^0.48.4 => 0.48.4
Target Platform: android 5.1.1 (XIAOMI Redmi 3) | Android versions less than 6.0
Steps to Reproduce
- Add permission to AndroidManifest.xml:
<uses-permission android:name="android.permission.VIBRATE"/>
- Add to project file
import { Vibration } from "react-native
- Run a vibration
Vibration.vibrate()
Tried to use:
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.VIBRATE" android:maxSdkVersion="18" />
<uses-permission-sdk-23 android:name="android.permission.VIBRATE"/>
This one works for android 6+:
<uses-permission-sdk-23 android:name="android.permission.VIBRATE"/>
Expected Behavior
It shouldn’t throw an error
Actual Behavior
it doesn’t work
Reproducible Demo
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6
Top Results From Across the Web
Requires VIBRATE permission on Jelly Bean 4.2 - Stack ...
This was a bug in Android 4.2 due to a change in the notification vibration policy; the permission bug was fixed by this...
Read more >system.vibrate() not working on android even though vibrate ...
My android phone is running Android 7.0. The error says java.lang.SecurityException: Requires VIBRATE permission.
Read more >Android - Requires VIBRATE permission on Jelly Bean 4.2
Android – java.lang.SecurityException: Requires VIBRATE permission on Jelly Bean 4.2. androidandroid-4.2-jelly-beannotificationspush.
Read more >java.lang.SecurityException: Requires VIBRATE permission
AndroidJavaException: java.lang.SecurityException: Requires VIBRATE permission. Hello, I have vibrations (using Handheld.Vibrate() and one ...
Read more >Android 12 crashes when connecting to Bluetooth after ...
After asking for runtime permission for BLUETOOTH_CONNECT , android 12 crashes with java.lang.SecurityException: UID 10427 / PID 30221 lacks ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having same problem on RN 0.53.0 with
<uses-permission android:name="android.permission.VIBRATE"/>
but
<uses-permission-sdk-23 android:name="android.permission.VIBRATE"/>
works.
We are experiencing the same issue. In a native project, this will work
<uses-permission android:name="android.permission.VIBRATE"/>
But when usingVibration
from React-Native only using:works and only for Android 6+. android < 6 will crash.