Hello, i have a question about glance library. If ...
# glance
h
Hello, i have a question about glance library. If you implement it with Glance, can't you separate the app widget provider process with android:process=":remote"? I have a question because there is an issue where the update does not occur when the process is separated.
s
Interesting. I'll take a look and get back to you
Is this automatic updates, or manual updates calling updateAll (or the other update functions)(or both)
Glance has some configuration to use a non-default process. Add this to your AndroidManifest :
Copy code
<service
    android:name="androidx.work.impl.background.systemjob.SystemJobService"
    android:process=":remote"
    tools:node="merge" />
All widget receivers need to use the same process, but this should unblock you. LMK if that doesn't work (works on my machine)
h
I couldn't solve the problem just by following the guide, but it was a great healp. I share this with you below and have attached additional concerns as questions.
1) Apply code
Copy code
<receiver
          android:name=".widget.CustomAppWidgetReceiver"
          android:enabled="true"
          android:exported="false"
          android:process=":remote">
          ....
</receiver>
2) Issues and resolve 2-1) Error occurs (java.lang.IllegalStateException: WorkManager is not initialized properly.) → Remove default workmanager initializer at AndroidManifest.xml and declare custom workmanager's configuration
Copy code
<provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

class GlanceApp : Application(), Configuration.Provider {
    override val workManagerConfiguration: Configuration
        get() = Configuration.Builder().setDefaultProcessName(packageName).build()
}
2-2) Can't get Session object for key. It appears to be because the process in which the worker runs is not declared as :remote → It was resolved by setting :remote using the method mentioned above. 3) Question
Copy code
<service
    android:name="androidx.work.impl.background.systemjob.SystemJobService"
    android:process=":remote"
    tools:node="merge" />
→ It appears to be code that sets the process in which WorkManager operates to :remote Wouldn't this affect the operation of WorkManager, which is already being used in the default process?
s
Which version of glance are you using?
h
The version below is in use.
Copy code
implementation("androidx.glance:glance-appwidget:1.0.0")
    implementation("androidx.glance:glance:1.0.0")