Vibrate on push notification
<p>First of all I've checked all those links:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/30005055/how-to-call-vibrator-inside-a-service-in-android">How to Call Vibrator inside a Service in android</a></li>
<li><a href="https://stackoverflow.com/questions/13230162/android-notifications-and-vibrate-from-service">Android notifications and vibrate from service</a></li>
<li><a href="https://stackoverflow.com/questions/14195067/android-gcm-turn-on-lights">Android GCM turn on Lights</a></li>
</ul>
<p>But I can't achieve my phone vibrating when I receive a push notification. Here goes my code:</p>
<p><strong>PushReceiver</strong></p>
<pre><code>public class PushReceiver extends FirebaseMessagingService {
    public PushReceiver() {
    }

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        if(remoteMessage.getData() != null){
            Map&lt;String, String&gt; data = remoteMessage.getData();
            sendNotification(data.get(&quot;message&quot;));
        }
        else{
            if(remoteMessage.getNotification() != null) {
                sendNotification(remoteMessage.getNotification().getBody());
            }
        }
    }

    private void sendNotification(String messageBody) {
        Intent intent = new Intent(this, BaseActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
                PendingIntent.FLAG_ONE_SHOT);

        Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_done_all_24dp)
                .setContentTitle(getString(R.string.str_notification_order_ready))
                .setContentText(messageBody)
                .setSound(defaultSoundUri)
                .setContentIntent(pendingIntent);

        notificationBuilder.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });

        NotificationManager notificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);


        notificationManager.notify(ConstantUtils.NOTIFICATION_ID_ORDER_READY, notificationBuilder.build());
    }
}
</code></pre>
<p><strong>Permission</strong></p>
<pre><code>&lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot;/&gt;
</code></pre>
<p><strong>Testing</strong></p>
<blockquote>
<p>Device: Nexus 5</p>
<p>Android version: 6.0.1</p>
</blockquote>
<p>There is some kind of unknown sorcery that I should do to make it work?</p>