Conversation
kkuan2011
left a comment
There was a problem hiding this comment.
Once comments are addressed, you can add Aaron for review and remove from "draft" state, thanks!
…ant RequiresApi, simplify comment
kkuan2011
left a comment
There was a problem hiding this comment.
Ah actually looks like the build fails:
/home/runner/work/snippets/snippets/compose/snippets/src/main/java/com/example/compose/snippets/notifications/TimeSensitive.kt:120: Error: To call Service.startForeground(), the element of manifest file must have the foregroundServiceType attribute specified [ForegroundServiceType]
startForeground(notificationId, notification)
~~~~~~~~~~~~~~~
Explanation for issues of type "ForegroundServiceType":
For targetSdkVersion >= 34, to call Service.startForeground(), the
element in the manifest file must have the foregroundServiceType
attribute specified.
https://github.com/android/snippets/actions/runs/35001625484/job/104492132218?pr=1079
…heck The suppression silenced the lint check but left code that throws on API 34 and higher, where startForeground() needs a foregroundServiceType on the <service> element. Declare the service with shortService, which needs no runtime permission request, and drop the suppression. The service class stops being private, because the framework instantiates it. The region tag content does not change, so the snippet on the page stays the bare startForeground() call.
|
@kkuan2011 the |
kkuan2011
left a comment
There was a problem hiding this comment.
Approved, assuming the build passes (Still running)
Code snippets are for:
List of modifications:
Snippets not migrated: