The push-notifications to the app are always sent, that's not the problem. The problem is that the phone vibrates if it receives a new notifications from the app only if the app is open and the phone is not locked. If either the app is not open or the phone is locked, the phone will not vibrate on received notifications. Would there be a way to make the phone vibrate on received notifications even if it is locked or the app is not open? What could be the problem? From what I found, the notifications are created with the help of the following code:
public class NotifyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.notify(
remoteMessage.getMessageId(),
1,
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_paperplane)
.setContentTitle(remoteMessage.getNotification().getTitle())
.setContentText(remoteMessage.getNotification().getBody())
.setVibrate(new long[] { 150, 300, 150, 600})
.setAutoCancel(true)
.build());
super.onMessageReceived(remoteMessage);
}
}
The manifest has the vibrate and wake_lock permissions:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" /