allboatsrise / expo-marketingcloudsdk

Expo module for Salesforce Marketing Cloud SDK
MIT License
12 stars 12 forks source link

Impossible to run app in Expo GO #38

Closed danny88dam closed 4 months ago

danny88dam commented 5 months ago

Hi, I'm try to integrate this package in my project.

I follow the instruction in README file, but I'm getting this error message Error: Cannot find native module 'ExpoMarketingCloudSdk', js engine: hermes image

Here the installed packages image

Here a piece of code that throws the error, specifically at MarketingCloud.setSystemToken (the very first call to MarketingCloud utilities) `; (async () => {

    ...

    const token = await Notifications.getDevicePushTokenAsync()
    // let Marketing Cloud SDK the value of current push token
    try{
      MarketingCloud.setSystemToken(token.data)
        .then(response => {
          setStatus(response ?? "null response from MC")
        })

      // In rare situations a push token may be changed by the push notification service while the app is running.
      const subscription = Notifications.addPushTokenListener((newToken) => {
        MarketingCloud.setSystemToken(newToken.data)
      })
      cleanup = () => subscription.remove()
    }
    catch(e: any){
      setStatus(e.message)
    }
  })()

` The error is thrown only on Expo Go, when I build the app (via eas) for internal distribution all seems to work well.

Thank you

andrejpavlovic commented 4 months ago

This cannot work in Expo Go since you have to use custom native libraries. Look into build a custom client.

danny88dam commented 4 months ago

Ok, thank you.

Maybe can be usefull to know building app via eas build with developmentClient: true image can help to avoid the problem

\D