1

I'm working in a notification app for Android and my customer has requested me to insert a video inside the notification preview.

I know that I'm able to create notifications with pictures and notifications with custom views, but when I try to add a video to the custom view my app gives me always this error:

FATAL EXCEPTION: main Bad notification posted from package com.codeversed.example.Notifications: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.codeversed.example.Notifications user=UserHandle{0} id=0 tag=null score=0 key=0|com.codeversed.example.Notifications|0|null|10008: Notification(pri=0 contentView=com.codeversed.example.Notifications/0x1090089 vibrate=default sound=default defaults=0x7 flags=0x18 color=0x00000000 originalPackageName=N originalUserId=0 vis=PRIVATE))

I suppose that is it because videos aren't allowed to remote views. Does somebody know if this limitation can be sorted or if there is a way to show videos on notifications?

Regards,

gabicuesta
  • 329
  • 5
  • 17

1 Answers1

6

No, you cannot show a video in a Notification. Partially, that is because RemoteViews does not support a SurfaceView, TextureView, or VideoView that you would need. Partially, that is because the party responsible for showing the video may not have rights to do so (e.g., may not have Internet access). Remember that you are not the one actually showing the Notificationsomebody else is. You merely provide the specification.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491