我正在使用service workers
。我需要它来实现push
通知。我想要实现的是,当我收到通知时,至少应该有声音或震动。
self.registration.showNotification(title, {
body: body,
icon: './assets/images/icons/icon_144x144.png',
vibrate: [200, 100, 200, 100, 200, 100, 200],
});
我在收到通知时有这段代码。
问题1:根本没有震动。后来我进行了一些调试。
https://googlechrome.github.io/samples/notifications/vibrate.html 这个不会使我的手机振动。
https://googlechrome.github.io/samples/vibration/index.html 这个会让我的手机振动。
为什么第一个链接不会振动?我是在Android Chrome
上进行测试的。
问题2:看起来在火狐浏览器上,它确实有默认的声音。为什么谷歌没有相同的声音?它只会变成静音。我没办法播放声音吗?至少我想要振动它...