2016-11-08 1 views
0

사용자가 알림을 사용할지 여부를 선호하는 경우. 알림을 보낼 때이 사용자를 제외 할 수 있도록 어떤 이벤트를 보내야합니까?Firebase android audience

답변

0

onMessageReceived 메서드에서 SharedPReferences에 알림 (bool) = true가 있으면 유효성 검사를 시도하십시오. 에서

@Override 
public void onMessageReceived(RemoteMessage remoteMessage) { 
// ... 



// TODO(developer): Handle FCM messages here. 
// Not getting messages here? See why this may be 
Log.d(TAG, "From: " + remoteMessage.getFrom()); 

// Check if message contains a data payload. 
if (remoteMessage.getData().size() > 0) { 
    Log.d(TAG, "Message data payload: " + remoteMessage.getData()); 
} 

// Check if message contains a notification payload. 
if (remoteMessage.getNotification() != null) { 
    Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody()); 
} 

// Also if you intend on generating your own notifications as a result of a received FCM 
// message, here is where that should be initiated. See sendNotification method below. 
} 

: https://firebase.google.com/docs/notifications/android/console-audience

+0

앱이 백그라운드에있는 경우가 작동하지 않습니다, 전경 사용을 위해 보인다. 대신 사용자 세그먼트를 사용하기로 결정했다. setUserProperty ("ifNotification", "false"); – ywj7931