2017-11-15 2 views
0

android (애플리케이션이 백그라운드에서 푸시를받을 때 발생)의 FCM 알림을 클릭하여 처리 할 수 ​​있습니까? 나는 이걸 보았다 one of possible way solve this problem. enter image description heredocumentation에서 흥미로운 순간을 발견했습니다 (그림 참조). 그럼 내가 어떻게 만들 수 있니?Handle FCM 알림 클릭

+0

[Firebase (FCM) : 열린 활동 및 통지 클릭시 데이터 전달 가능한 복제본. android] (https://stackoverflow.com/questions/40181654/firebase-fcm-open-activity-and-pass-data-on-notification-click-android) – Kota1921

+0

마침내 솔루션을 발견했습니다 - https : // stackoverflow .com/questions/40181654/firebase-fcm-open-activity-and-pass-data-on-notification-click-android – Kota1921

답변

0

해킹 할 수 있습니다. 적절한 방법인지는 모르겠지만 작동합니다!

알림 클릭시 열리는 활동에서 onCreate 메소드를 확인하십시오.

protected void onCreate(@Nullable Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
if(java.lang.Integer.toHexString(getIntent().getFlags()).equals("14000000")) 
{ 
    //Activity is launched from the notification created by android 
} 
} 

알림이 FirebaseMessagingService 클래스에서 생성되는 다른 경우. 인 텐트를 추가로 전달하고 해당 활동이 활성 상태인지 확인할 수 있습니다. 작성 방법