This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Android - Vibration not working? #1683
Closed
Description
Bug
Vibration does not work with the following code:
PushNotification.createChannel(
{
channelId: "com.tenantmovein.notifications", // (required)
channelName: "TMI Notifications", // (required)
channelDescription: "TMI notifications.", // (optional) default: undefined.
soundName: "default", // (optional) See `soundName` parameter of `localNotification` function
// (optional) default: 4. Int value of the Android notification importance
// make it match calls to .localNotification priority
importance: 4,
vibrate: true, // (optional) default: true. Creates the default vibration patten if true.
},
(created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
);
PushNotification.localNotification({
/* Android Only Properties */
id: id,
channelId: "com.tenantmovein.notifications",
autoCancel: true,
vibrate: true,
vibration: 1000,
priority: "high",
visibility: "public",
/* iOS only properties */
//alertAction: 'view',
userInfo: {id: id}, // required for ios local notification
/* iOS and Android properties */
title: title,
message: message, // (required)
playSound: sound,
soundName: sound ? 'default' : undefined,
// number: number // silly library, iOS requires number, while android string...
});
<uses-permission android:name="android.permission.VIBRATE" />
Environment info
react-native info
output:
info Fetching system and libraries information...
System:
OS: macOS 10.15.7
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Memory: 1.01 GB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.16.3 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 23, 26, 28, 29
Build Tools: 28.0.3, 29.0.2
Android NDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_121 - /usr/bin/javac
Python: 2.7.15 - /Library/Frameworks/Python.framework/Versions/2.7/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Library version: 6.1.1
Steps To Reproduce
See code above
Describe what you expected to happen:
Notifications should also include vibration.
Metadata
Metadata
Assignees
Labels
No labels