Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

How to control vibration on Android via FCM payload? #2674

Open
SmirnovM91 opened this issue Jan 9, 2019 · 1 comment
Open

How to control vibration on Android via FCM payload? #2674

SmirnovM91 opened this issue Jan 9, 2019 · 1 comment

Comments

@SmirnovM91
Copy link

Expected Behaviour

Actual Behaviour

Reproduce Scenario (including but not limited to)

Setting data.vibrate to false or true is not working.

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 8.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Xiaomi Redmi 5

Cordova CLI version and cordova platform version

cordova --version    = 8.1.2
cordova platform version android  = 7.1.4

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

phonegap-plugin-push 2.2.3 "PushPlugin"

Sample Push Data Payload

var message = {
to: user.deviceId,
data: {
title: title,
body: body,
sound: "default" ,
vibrate: true | false, ---> not working
notId: new Date().getMilliseconds(),
priority: 1
},
}

Sample Code that illustrates the problem

Logs taken while reproducing problem

@ppetree
Copy link

ppetree commented Jan 9, 2019

Try implementing a channel. I know they're only required on Android 8+ but they appear to work on versions < 8.

  PushNotification.createChannel(() => {},() => {},
  {
            id: 'vibrate',
            description: 'Make The Phone Buzz',
            importance: 5,
            vibration: true,
            sound: 'mysound' 
  });

then in your payload reference this channel and your phone will vibrate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants