react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

vibrate:false is ignored in "vibrate mode"

Open daheeahn opened this issue 3 years ago • 12 comments

react-native: 0.63.4 react-native-push-notification: 7.3.1

I created 2 channel

      PushNotification.createChannel(
        {
          channelId: 'channel a',
          channelName:  'channel a',
          channelDescription: 'description a',
          vibrate: true,
        },
        (created: boolean) => {},
      );

      PushNotification.createChannel(
        {
          channelId: 'channel b',
          channelName:  'channel b',
          channelDescription: 'description b',
          vibrate: false,
        },
        (created: boolean) => {},
      );

I made push

...
PushNotification.localNotificationSchedule({
    channelId: 'channel a',
    id: 1,
    date: new Date(JSON.parse(obj.date)),
    autoCancel: false,
    ongoing: false,
    allowWhileIdle: true,
    userInfo: obj,
    title,
    message,
    playSound,
    soundName,
    volume: _volume,
    vibrate: true,
    vibration: 2000,
    repeatType,
    repeatTime,
    ignoreInForeground: false,
});

...
PushNotification.localNotificationSchedule({
    channelId: 'channel b',
    id: 2,
    date: new Date(JSON.parse(obj.date)),
    autoCancel: false,
    ongoing: false,
    allowWhileIdle: true,
    userInfo: obj,
    title,
    message,
    playSound,
    soundName,
    volume: _volume,
    vibrate: false, // Changed it to false because it was written as true
    vibration: 2000,
    repeatType,
    repeatTime,
    ignoreInForeground: false,
});

[My test device (Android Galaxy S9) setting] -> Vibrate Mode -> When I created a push with ids 1 and 2 id(1) - not vibrate (normal) id(2) - vibrate (abnormal - I expected no vibrate in vibrate mode)

I created 'channel b' with vibrate false, why does id 2 push vibrate in vibrate mode? How can I solve this?

daheeahn avatar Jun 21 '21 11:06 daheeahn

hi @daheeahn

Make sure the channel b wasn't created with vibrate: true then changed to vibrate: false. Update a channel is not possible.

Regards

Dallas62 avatar Jun 21 '21 11:06 Dallas62

@Dallas62 I didn't understand. 'channel b' created with vibrate: false. and I removed app and reinstalled. How can I do?

daheeahn avatar Jun 21 '21 11:06 daheeahn

Can you check in phone settings if the created channel is with vibration disabled ? We need to make sure channels are correctly configured.

Dallas62 avatar Jun 21 '21 11:06 Dallas62

FYI, If the push made with the b-channel is in sound mode, it doesn't vibrate as I expected. But in vibrate mode, it vibrates.

daheeahn avatar Jun 21 '21 12:06 daheeahn

Channel a, b in order

daheeahn avatar Jun 21 '21 12:06 daheeahn

Hi @daheeahn If everything is right, I suggest you to set vibrate: false in your PushNotification.localNotificationSchedule call. If vibrate is ignore, it's probably an issue (behavour?) of Android... The library create the channel correctly and apply all parameters send by your application. After that it's Android which handle the notification. Regards

Dallas62 avatar Jun 24 '21 06:06 Dallas62

Oh, I changed the vibrate of push with id: 2 to false because it was written as true by mistake.

daheeahn avatar Jun 24 '21 07:06 daheeahn

It's a very simple test, can you try it yourself on your Android device? I think I typed everything well as provided by the library.

daheeahn avatar Jun 24 '21 07:06 daheeahn

I'm confused, but can you fix your exemple ? You said notification with id 1 is not vibrating, but in your exemple it's suppose to vibrate. And the id 2 is vibrating when you don't expect it. I suspect a channel swap

Dallas62 avatar Jun 24 '21 15:06 Dallas62

When the push with id 2 is in sound mode or silent mode, it doesn't vibrate as I want it to. But in vibrating mode, it vibrates. I think it should not vibrate even in vibrate mode, but I don't know why it vibrates only in vibrate mode. And the channel was not confused. (Only Android)

daheeahn avatar Jun 24 '21 17:06 daheeahn

Ok, but reading your initial post, channel b (notification id 2) is all no vibration.

Dallas62 avatar Jun 24 '21 18:06 Dallas62

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 25 '22 00:06 github-actions[bot]