expo-updates Updates.addListener is not working

Updates.addListener is not being called

Updates.addListener(event => console.log({event}));

the above code is not logging anything

Am I doing it wrong? how to use this event listener?

Hey @clumsyknight, your code looks correct for the most part. Two things:

  1. Your console log is destructuring the event object and looking for a field event that doesn’t exist. Only type, manifest and message are valid fields on the UpdateEvent object.

  2. Can you ensure you are testing this in a release version of your app?

Cheers,
Adam

sorry for replying so late

Yes, I was testing the release version and the issue was in app.json. Where updates.checkAutomatically was set to "ON_ERROR_RECOVERY", which is why the event listener wasn’t working. Reverting it to "ON_LOAD", got the event listener working.

Thank you for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.