Status Update
Comments
da...@gmail.com <da...@gmail.com> #2
Is there any way to use this while it's not available, without a big if else where we do everything duplicated? Like this example.
val notification = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
Notification.Builder(...)
.setContentTitle("Title")
.setStyle(...)
// Duplicate everything here!!!
.build()
} else {
NotificationCompat.Builder(...)
.setContentTitle("Title")
.setStyle(...)
// Duplicate everything here!!!
.build()
}
pm...@google.com <pm...@google.com> #3
Hi,
Could you at least tell us if you will add the CallStyle to the NotificationCompat API?
Best regards,
ra...@google.com <ra...@google.com> #4
Yes. Our goal is to provide an implementation that uses CallStyle on API 31+ and uses the new fields to produce a usable call notification, based on the device's standard template, on older versions of Android.
ap...@google.com <ap...@google.com> #5
Thanks for the answer. Do you have an estimated ETA?
an...@google.com <an...@google.com> #6
Any update on this please?
mu...@gmail.com <mu...@gmail.com> #7
Could you please give us an ETA?
ra...@google.com <ra...@google.com> #8
Hello again,
It's been a while now that Android 12 has been released, and it would be great to have an estimated time of arrival for this feature in appcompat package so we can plan our developments & releases as app developers.
Thanks in advance.
mu...@gmail.com <mu...@gmail.com> #9
Any update on this please?
ra...@google.com <ra...@google.com> #10
mu...@gmail.com <mu...@gmail.com> #11
Is someone there? -_-
ey...@gmail.com <ey...@gmail.com> #12
Google has left the bugtracker
ra...@google.com <ra...@google.com> #13
Any news?
Description
Version used: 2.2.0-rc04
Devices/Android versions reproduced on: Pixel 4 - Android 10
WorkManager now support long running workers with foreground notification:
And the Javadoc for ForegroundInfo clearly shows that I can specify the foregroundServiceType as I would for a standard foreground service:
Except when I do:
setForegroundAsync(
ForegroundInfo(
NOTIFICATION_ID,
syncNotificationManager.createSyncForegroundNotification(),
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
or ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
)
from my Work I get this exception as soon as I try to run the work:
java.lang.IllegalArgumentException: foregroundServiceType 0x00000011 is not a subset of foregroundServiceType attribute 0x00000000 in service element of manifest file
at android.os.Parcel.createException(Parcel.java:2075)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6136)
at android.app.Service.startForeground(Service.java:742)
at androidx.work.impl.foreground.SystemForegroundService$1.run(SystemForegroundService.java:118)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1276)
at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:914)
at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:13964)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2784)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
The reason is that the work library still rely on the service manifest which has no foregroundServiceType attribute specified (0x00000000) and i'm requesting a specific foregroundServiceType (0x00000011).
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:directBootAware="false"
android:enabled="@bool/enable_system_foreground_service_default"
android:exported="false"
tools:targetApi="n" />
my current workaround is to just copy this in my manifest and add my foregroundServiceType.
I briefly tried and seems like it is working as I want but I'm not sure if this is ok. If this is the correct way it should be documented!
This is what I added to my manifest:
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:directBootAware="false"
android:enabled="@bool/enable_system_foreground_service_default"
android:exported="false"
android:foregroundServiceType="connectedDevice|dataSync"
tools:targetApi="n" />
I copied yours and added
android:foregroundServiceType="connectedDevice|dataSync"
which is what I needed.