different between PendingIntent FLAG
Setting PendingIntent.FLAG_UPDATE_CURRENT
Based on the documentation for PendingIntent.FLAG_UPDATE_CURRENT
:
Flag indicating that if the described PendingIntent already exists, then keep it but replace its extra data with what is in this new Intent.
Usage
This can be used if you are creating intents where only the extras change, and don't care that any entities that received your previous PendingIntent will be able to launch it with your new extras even if they are not explicitly given to it.
Setting Value to 0
Setting no flags, i.e. 0 as the flags parameter, is to return an existing PendingIntent
if there is one that matches the parameters provided. If there is no existing matching PendingIntent
then a new one will be created and returned
FLAG_CANCEL_CURRENT : 이전에 생성한 PendingIntent 는 취소하고 새롭게 만든다.
FLAG_NO_CREATE : 이미 생성된 PendingIntent 가 없다면 null 을 return 한다. 생성된 녀석이 있다면 그 PendingIntent 를 반환한다. 즉 재사용 전용이다.
FLAG_ONE_SHOT : 이 flag 로 생성한 PendingIntent 는 일회용이다.
FLAG_UPDATE_CURRENT : 이미 생성된 PendingIntent 가 존재하면 해당 Intent 의 Extra Data 만 변경한다.