2016-10-19 11 views
0

다른 제안에 대해 스택 오버플로를 검색했지만 지금까지 아무 도움도받지 못했습니다.휴대 전화가 잠 들어있을 때 Android 알림이 진동하지 않습니다.

firebase를 사용하여 푸시 알림을 테스트하고 있습니다. 내 응용 프로그램에 사용되는 서비스는 메시지 페이로드를 검색하고 앱 또는 전화가 켜져있을 때 알림을 구성하고 표시합니다. 휴대 전화를 잠그면 메시지가 여전히 firebase에서 검색되고 알림이 생성되지만 문제는 내 휴대 전화를 진동시키는 것처럼 보이지 않으므로 어떤 알림도 전혀 수신되지 않았 음을 알 수 없습니다. 사람이 도움을 제공 할 수있는 경우

@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()); 

} 

하는, 즉 좋은 것 :

여기에 통지가 구성되어 내 서비스입니다!

감사합니다.

+2

봐를 호출 할 수 있습니다 수신 될 때마다 현재 https://developer.android.com/reference/android/os/Vibrator.html

에서 체크 아웃 할 수 있습니다 http://stackoverflow.com/questions/37809885/firebase-push-notifications-update- DB – Nirel

답변

0

진동기라는 Android의 클래스/메소드가 있습니다. 알림 당신이 여기에 방법을