Commit 436ff6d8 by christosts Committed by Rohit Singh

Make DefaultMediaNotificationProvider more configurable

Add a Builder to constructor DefaultMediaNotificationProvider. The
Builder can also set the provider's:
- notification ID
- notification channel ID
- notification channel name

The change adds an API for apps to set the small icon in notifications.

#minor-release
Issue: androidx/media#104
PiperOrigin-RevId: 462111536
parent 7cb7636e
......@@ -19,6 +19,12 @@
* Ensure commands are always executed in the correct order even if some
require asynchronous resolution
([#85](https://github.com/androidx/media/issues/85)).
* Add `DefaultNotificationProvider.Builder` to build
`DefaultNotificationProvider` instances. The builder can configure the
notification ID, the notification channel ID and the notification
channel name used by the provider. Also, add method
`DefaultNotificationProvider.setSmallIcon(int)` to set the notifications
small icon ([#104](https://github.com/androidx/media/issues/104)).
### 1.0.0-beta02 (2022-07-15)
......
......@@ -32,6 +32,7 @@ android {
}
dependencies {
api project(modulePrefix + 'lib-common')
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
implementation 'androidx.collection:collection:' + androidxCollectionVersion
......
......@@ -433,7 +433,8 @@ public abstract class MediaSessionService extends Service {
synchronized (lock) {
if (mediaNotificationManager == null) {
if (mediaNotificationProvider == null) {
mediaNotificationProvider = new DefaultMediaNotificationProvider(getApplicationContext());
mediaNotificationProvider =
new DefaultMediaNotificationProvider.Builder(getApplicationContext()).build();
}
mediaNotificationManager =
new MediaNotificationManager(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment