Dynamic Island lifecycle

I am implementing the live activity in my project, it is a timer live activity so I have to dismiss it after the time ends for the particular activity. so for that, I'm doing it like this :

   Task {
            await activity.end(dismissalPolicy: .after(Date().addingTimeInterval(TimeInterval(1 * time))))
          }

it is working fine for live activity but when I'm calling this method while creating the live activity my dynamic island is not visible.

am I doing something wrong here or missing out something.

Dynamic Island lifecycle
 
 
Q