I'm following android's documentation on creating a custom notification for media playback controls. I read that it was recommended to set the style of the notification to DecoratedMediaCustomViewStyle, however this gives me the following compilation error.
error: cannot find symbol class DecoratedMediaCustomViewStyle
I'm importing DecoratedMediaCustomViewStyle
from android.support.v4.app.NotificationCompat
. When I try and use DecoratedCustomViewStyle
, my media playback buttons in my notification do not work. But when I exclude setting the style, then my buttons work but the notification isn't decorated with the large icon and title.
Any help is appreciated.
This worked for me rather
import androidx.core.app.NotificationCompat;
instead of android.support.v4.media.app.NotificationCompat
OR android.support.v4.app.NotificationCompat
I found it. I had to import from android.support.v4.media.app.NotificationCompat
instead of android.support.v4.app.NotificationCompat
.
I have been getting this error for a npm package I use (/@aws-amplify/pushnotification) when assembling release build (./gradlew assembleRelease
) in a react-native project.
Resolved with Jetifier, which can be done by:
yarn add jetifier --dev
or npm install jetifier --save-dev
Then adding these to scripts in package.json:
"postinstall": "jetify",
"jetify": "npx jetify"
Then run yarn run jetifier
or npm run jetifier
./gradlew clean && ./gradlew assembleRelease
and build is successful. I assume androidx related issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With