OneSignal / OneSignal-Unity-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Other
222 stars 61 forks source link

Push to Start Live Activities #738

Closed brismithers closed 5 months ago

brismithers commented 5 months ago

Description

One Line Summary

Update SDK to support Live Activities PushToStart and add a concept of a "Default" Live Activity to facilitate easier adoption.

Details

Push to Start Live Activities

Starting with iOS 17.2, Live Activities can now be started via push notification (Apple's documentation). This change enhances the OneSignal SDK to provide application's access to the full suite of Live Activity functionality.

Default Live Activity

The concept of a "Default" Live Activity has been established in the SDK, which eliminates the need for a customer app to define and manage their own ActivityAttributes. This is most beneficial for wrapper-SDKs, as they will no longer need to create their own cross-platform <-> native iOS bridge to establish this management. The following new external interfaces are provided for customer app's to use:

The downside to using the default Live Activity is:

Alternative (low level) method to setup Live Activities with OneSignal

If a customer app does not want to use the default live activity they can still create their own native ActivityAttribute structure and manage the live activity lifecycle themselves. These methods require the application to listen for pushToStart token updates, the starting of live activities, and update token updates. This encompasses existing
functions OneSignal.LiveActivities.Enter and OneSignal.LiveActivities.Exit which are documented here. Additional new methods to cover registering/unregistering pushToStart tokens have been created:

Motivation

Full support of Live Activities functionality introduced in iOS 17.2

Scope

Live Activities

Testing

Manual testing

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable

shepherd-l commented 5 months ago

Also tested for Android

Tested with the example app built with Unity 2021.3.10f1: Called all live activity methods: StartDefault, Enter, Exit, SetPushToStartToken, RemovePushToStartToken Device: Pixel 6 Emulator with Android 13