evollu / evollu/react-native-fcm
Android device not vibrating on receiving notification
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 661
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Notification have been working pretty well with the plugin. On iOS, there is sound, vibration and heads-up notification which is pretty good. But on Android, there is no vibration and heads-up notification.
I have been trying to figure out how to make the device vibrate on receiving a notification. I have tried different things like changing the payload format with "data" parameter, changing the priority and so on as per various answers on similar issues and other resources but nothing seems to work.
I have looked in the native code and specifically in SendNotificationTask.java file and I see that there is **.setVibrate(new long[]{0, DEFAULT_VIBRATION})** in place but that doesn't seem to work.
I have looked up into this **setVibrate** method and read that to make device vibrate we need to import vibrator module and use it as per the code snippet below.
```
import android.os.Vibrator;
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(500);
```
There is no setVibrate method being used in this example. I am new to android with no development experience but I wonder if we have to import the vibrator module(which i don't see in the SendNotificationTask.java file) or is there a way we can use the above snippet itself instead of the setVibrate method. Please advise
We would have liked to heads-up notifications as well to work on android but vibration is the top priority now.
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.