본문 바로가기
안드로이드

Firebase FCM 에러, AndroidRuntimeException: Calling Activity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.

by 책 읽는 개발자_테드 2020. 1. 31.
반응형

android 9 이상 버전에서 FCM 메세지를 받고, Service에서 새로운 Activity를 생성할때 제목의 메세지와 함께 액티비티가 강제 종료되는 오류가 발생한다.

 

이때, Activity를 생성할때 아래와 같이 intent에 addFlags 메소드를 실행해주면 해결된다.

 

intent.addFlags(FLAG_ACTIVITY_NEW_TASK);

 

반응형

댓글