zetavg / react-native-system-notification

Android system notifications for React Native. Supports push notifications with GCM integrated.
https://www.npmjs.com/package/react-native-system-notification
244 stars 102 forks source link

Sound / vibration #15

Open nabati opened 8 years ago

nabati commented 8 years ago

Neither sound nor vibration seems to be working at the moment.

Is the documentation not up to date?

zetavg commented 8 years ago

It works fine to me. What's the Android and React Native version are you using?

paulomenezes commented 8 years ago

@Neson the same with me, I'm using Android 6.0 and React Native 0.16

zetavg commented 8 years ago

I see, but I can't accurately identify the problem yet. Providing a sample project that reproducing the problem will be a big help to solve this issue!

To move a few steps ahead: 1. Are you using local notifications or GCM push notificaions? 2. Are you sure the android.permission.VIBRATE permission is added to AndroidManifest.xml?

Thank you for the feedback!

paulomenezes commented 8 years ago

I'm using GCM and in my AndroidManifest has:

<uses-permission android:name="android.permission.VIBRATE" />

paulomenezes commented 8 years ago

I put this in Notification.java:

Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notificationBuilder.setSound(soundUri);
notificationBuilder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
notificationBuilder.setLights(Color.RED, 3000, 3000);

and works. I don't know the lights, this not works on my phone.