cristianoalves92 / react-native-live-activity

MIT License
82 stars 17 forks source link

Updating in background? #1

Open zackify opened 1 year ago

zackify commented 1 year ago

How would you propose updating the activities in the background?

could you run a background task in react native that calls updateActivity periodically?

Or would you have to setup the push notification flow

anthlasserre commented 1 year ago

If you want to support background tasks at some point I think you can use that library https://github.com/ocetnik/react-native-background-timer

anthlasserre commented 1 year ago

@zackify I can confirm that this is working great.

mrados7 commented 1 year ago

@anthlasserre I will give this a try, I thought you cannot update anything in background from javascript as it is being "killed" when using React Native. One solution that I know will work for a fact is to use Apple APN service to send live notification update. https://developer.apple.com/documentation/activitykit/updating-live-activities-with-activitykit-push-notifications

anthlasserre commented 1 year ago

Yeah indeed, the best solution ever to update Live Activity widgets is to populate the values through push notifications payload. For instance 3rd parties like Braze & OneSignal already support these features.

anthlasserre commented 1 year ago

As this issue is outside the scope of React Native, should we close it, @mrados7 ?

mrados7 commented 1 year ago

@anthlasserre I agree, you can close this one.

anthlasserre commented 1 year ago

@zackify ?