Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options empty, resulting in no drawable icon? #13

Open
thoasty-dev opened this issue Feb 8, 2022 · 5 comments
Open

Options empty, resulting in no drawable icon? #13

thoasty-dev opened this issue Feb 8, 2022 · 5 comments

Comments

@thoasty-dev
Copy link
Contributor

thoasty-dev commented Feb 8, 2022

I was stuck on the issue, that android always crashed on loading a playlist, because there was not small icon set:

AndroidRuntime: java.lang.RuntimeException: Unable to start service org.dwbn.plugins.playlist.service.MediaService@e78b87b with Intent { act=com.devbrackets.android.playlistcore.start_service cmp=**.**.**/org.dwbn.plugins.playlist.service.MediaService (has extras) }: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=PlaylistCoreMediaNotificationChannel shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 category=transport actions=3 vis=PUBLIC)

I dont know much about the icon system in android / capacitor / cordova, but it came down to these lines:
(MediaImageProvider.ts:52 and following)

private val mipmapIcon: Int
  get() {
    Log.i("options", options.toString())
      // return R.mipmap.icon; // this comes from cordova itself.
      if (notificationIconId <= 0) {
          notificationIconId = fakeR.getId("drawable", options?.icon)
      }
      return notificationIconId
  }

When I log options at this point, its always an empty object, even though I set the options before like this as documented:

player.setOptions({
  verbose: true,
  options: {
    icon: 'ic_notification'
  }
})

Has anybody got this to work on android and can share their code?

Best regards

@PavelShvets-dev
Copy link

Hi!
Got the same issue yesterday and after short research found that there should be icon.png file into each drawable folder.
drawable-icon

@PavelShvets-dev
Copy link

PavelShvets-dev commented Feb 8, 2022

BTW, notification icon could be easily generated here:
https://romannurik.github.io/AndroidAssetStudio/icons-notification.html

@thoasty-dev
Copy link
Contributor Author

Thank you very much for your help and the link. I will try it out asap. Btw, the link is kinda bugged and leads to /issues/url

@PavelShvets-dev
Copy link

Thank you very much for your help and the link. I will try it out asap. Btw, the link is kinda bugged and leads to /issues/url

Thanx, link fixed 🙂

@phiamo
Copy link
Owner

phiamo commented Mar 27, 2022

honestly this is maybe the oldest part in my codebase and i am not an expert on android neither.
i got a "resource id" set there as well and have corresponding pngs in the drawable folder
https://developer.android.com/guide/topics/resources/drawable-resource

what was the resolution? How can we improve docs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants