ios – Altering the reside exercise with out push notification


I’m attempting to implement “Dwell exercise” to my app. I’m following the Apple docs.

Hyperlink: https://developer.apple.com/documentation/activitykit/displaying-live-data-with-live-activities

Instance code:

struct LockScreenLiveActivityView: View {
    let context: ActivityViewContext<PizzaDeliveryAttributes>
    
    var physique: some View {
        VStack {
            Spacer()
            Textual content("(context.state.driverName) is on their means along with your pizza!")
            Spacer()
            HStack {
                Spacer()
                Label {
                    Textual content("(context.attributes.numberOfPizzas) Pizzas")
                } icon: {
                    Picture(systemName: "bag")
                        .foregroundColor(.indigo)
                }
                .font(.title2)
                Spacer()
                Label {
                    Textual content(timerInterval: context.state.deliveryTimer, countsDown: true)
                        .multilineTextAlignment(.heart)
                        .body(width: 50)
                        .monospacedDigit()
                } icon: {
                    Picture(systemName: "timer")
                        .foregroundColor(.indigo)
                }
                .font(.title2)
                Spacer()
            }
            Spacer()
        }
        .activitySystemActionForegroundColor(.indigo)
        .activityBackgroundTint(.cyan)
    }
}

Truly, the code is fairly easy. We will use the timerInterval for count-down animation. However when the timer ends, I wish to replace the Dwell Exercise view. If the consumer re-opens the app, I can replace it, however what occurs if the consumer would not open the app? Is there a solution to replace the reside exercise with out utilizing push notifications?

Leave a Reply