question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] java.lang.SecurityException: Requires VIBRATE permission

See original GitHub issue

Is 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

  1. Add permission to AndroidManifest.xml: <uses-permission android:name="android.permission.VIBRATE"/>
  2. Add to project file import { Vibration } from "react-native
  3. 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:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

4reactions
okkancommented, Mar 6, 2018

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.

1reaction
drorbirancommented, Mar 13, 2018

We are experiencing the same issue. In a native project, this will work <uses-permission android:name="android.permission.VIBRATE"/> But when using Vibration from React-Native only using:

<uses-permission-sdk-23 android:name="android.permission.VIBRATE"/>

works and only for Android 6+. android < 6 will crash.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found