0

After migration to Hilt (Activities and Workers), in-app messages stopped being displayed. As I can see from logs push message is getting delivered and PushMessageManager.handleMessage returns true.

During the implementation of the Hilt, none of the files related to SF was touched. So it can't be an implementation problem. Also, as I said downgrading the SFMC library version fixes issues. Also, handleMessage method returns true, so I believe that something is not working inside SDK. Is it possible to get logs from SDK? Do you use Workers in SFMC SDK?

I use SFMC SDK version 8.0.4. When I downgrade to version 7.4.2 in-app messages start showing.

UPDATE

After investigation I found out that we removed the Android start up library, which initializes the WorkManager by default, since we need to do it on-demand (Hilt requirement) by adding this to Manifest:

    <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.androidx-startup"
        tools:node="remove">
    </provider>

We also started using Hilt worker factory inside Application:

class MyApplication : Application(), Configuration.Provider {

...
@Inject lateinit var workerFactory: HiltWorkerFactory
...

override fun getWorkManagerConfiguration(): Configuration =
    Configuration.Builder()
        .setWorkerFactory(workerFactory)
        .build()
...

After removing this configuration in-app messages started appearing again.

0

1 Answer 1

0

A solution is to replace in the manifest with

<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <!-- If you are using androidx.startup to initialize other components -->
    <meta-data
        android:name="androidx.work.WorkManagerInitializer"
        android:value="androidx.startup"
        tools:node="remove" />
</provider>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .