cordova-plugin-code-push icon indicating copy to clipboard operation
cordova-plugin-code-push copied to clipboard

Sync on push notification in background possible?

Open digaus opened this issue 5 years ago • 3 comments

Description

Is it possible to sync from android native code in the background without the app running? For example from the onMessageReceive handler of FCM?

digaus avatar Aug 01 '19 22:08 digaus

See also https://github.com/Microsoft/react-native-code-push/issues/1233

digaus avatar Aug 06 '19 20:08 digaus

I definitively second this idea. It would nice to be able to have users download the bundle on the background so that when they open the app, they are directly interacting with the newer version rather than having to load an older JS bundle, checking with CodePush and downloading and THEN prompting user to reload app for optimal experience.

FrenchMajesty avatar Oct 07 '19 21:10 FrenchMajesty

wondering if codePush.sync can work with firebase.messaging().setBackgroundMessageHandler

e.g:

firebase.messaging().setBackgroundMessageHandler((message)=>{
  // only sync on FCM with specific data
  if(message.data.customDataToLetAppKnowIfShouldSync){
    codePush.sync();
  }
})

react-native-firebase: https://rnfirebase.io/messaging/usage#background-application-state

rnike avatar Oct 13 '21 07:10 rnike