[Android] Pending Intent

Greenddoovie·2022년 2월 3일
0

안드로이드

목록 보기
8/8

출처: Pending Intent

정의

A description of intent and target action to perform with it.

  • Pending Intent는 인텐트와 인텐트와 함께 수행하는 타겟 액션에 대한 서술이다

A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it

  • Pending Intent는 시스템이 유지하는 토큰에 대한 참조이다. 토큰은 데이터를 복구하는데 사용되는 원본데이터를 의미한다

상속구조

또한, PendingIntent는 이름과는 다르게 Intent를 상속하여 구현된 것이 아니라 Object를 상속하여 구현되었다.

Multiple PendingIntent

Intent내부에 putExtra를 이용하여 값을 다른 것을 넣는다고하여 여러 개의 pending intent가 생성되는 것이 아니다.

다양한 pending intent를 만들기 위해서는 intent.filterEquals(other intent)가 false 값을 반환하거나, different request code integer를 사용한다.

FLAG

  • FLAG_CANCEL_CURRENT: 이미 존재할 경우 삭제 (새로운 pending intent를 생성하기 전에)
  • FLAG_IMMUTABLE: 생성된 PendingIntent는 Immutable
  • FLAG_MUTABLE: 생성된 PendingIntent는 Mutable
  • FLAG_NO_CREATE: 묘사된 PendingIntent가 없다면 생성하지 않고 null을 반환
  • FLAG_ONE_SHOT: PendingIntent는 오직 한 번만 사용됨
  • FLAG_UPDATE_CURRENT: PendingIntent가 존재하면, Intent의 data를 새로운 Intent의 data로 치환
profile
기초를 이해하면 세상이 다르게 보인다

0개의 댓글