Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Fix for vibration on notifs for Android API >= 26 #1686

Merged
merged 3 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ To use channels, create them at startup and pass the matching `channelId` throug
);
```

**NOTE: Without channel, remote notifications don't work**
**NOTE: Without channel, notifications don't work**

In the notifications options, you must provide a channel id with `channelId: "your-channel-id"`, if the channel doesn't exist the notification might not e triggered. Once the channel is created, the channel cannot be update. Make sure your `channelId` is different if you change these options. If you have created a channel in another way, it will apply options of the channel.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
if (vibration == 0)
vibration = DEFAULT_VIBRATION;

vibratePattern = new long[]{0, vibration};
vibratePattern = new long[]{vibration};

notification.setVibrate(vibratePattern);
}
Expand Down Expand Up @@ -908,7 +908,7 @@ public boolean createChannel(ReadableMap channelInfo) {
String soundName = channelInfo.hasKey("soundName") ? channelInfo.getString("soundName") : "default";
int importance = channelInfo.hasKey("importance") ? channelInfo.getInt("importance") : 4;
boolean vibrate = channelInfo.hasKey("vibrate") && channelInfo.getBoolean("vibrate");
long[] vibratePattern = vibrate ? new long[] { DEFAULT_VIBRATION } : null;
long[] vibratePattern = vibrate ? new long[] { 0, DEFAULT_VIBRATION } : null;

NotificationManager manager = notificationManager();

Expand Down