I have searched through stack overflow for different suggestions but none have helped me so far.
I am testing push-notifications using firebase. The service used in my application retrieves the message payload just fine and will construct and display the notification when the app or phone is on. When I lock my phone, the message is still retrieved from firebase and the notification is still constructed, but the problem is, it doesn't seem to vibrate my phone so I'm not aware any notification has been received at all.
Here is my service and where the notification is constructed:
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// TODO: Handle FCM messages here.
// If the application is in the foreground handle both data and notification messages here.
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated.
Log.d(TAG, "From: " + remoteMessage.getFrom());
Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(remoteMessage.getFrom())
.setContentText(remoteMessage.getNotification().getBody())
.setPriority(Notification.PRIORITY_MAX)
.setVibrate(new long[] {100, 500, 100, 500, 100 ,500});
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(001, notificationBuilder.build());
}
If anyone can offer some help, that would be great!
Thanks!