google / flutter.plugins

BSD 3-Clause "New" or "Revised" License
117 stars 55 forks source link

Customize the small icon #45

Closed ianko closed 4 years ago

ianko commented 4 years ago

Adds the ability to customize which smallIcon to display in the notification. This is specially important if the app doesn't use a transparent ic_launcher image or wants to use a different icon for the player/notification.

The service will fallback to the app's ic_launcher if the metadata is not set in the AndroidManifest.xml.

Instructions added to the README.md. 👇

Android small icon

If you see a white box in place of the small notification icon it's probably because your app icon doesn't have a transparent background. You can specify which icon the audiofileplayer plugin should use by including the following metadata in your AndroidManifest.xml.

<meta-data android:name="ic_audiofileplayer" android:value="drawable/notification_icon" />

Don't forget to include the icons to your res/drawable-{density} directories. Example:

Path Image Size
res/drawable-mdpi/notification_icon.png 24x24
res/drawable-hdpi/notification_icon.png 36x36
res/drawable-xhdpi/notification_icon.png 48x48
res/drawable-xxhdpi/notification_icon.png 72x72
res/drawable-xxxhdpi/notification_icon.png 96x96
res/drawable-xxxhdpi/notification_icon.png 256x256

_(The filename notification_icon.png was just used as an example, you can use any other file as desired.)_

ianko commented 4 years ago

@monkeyswarm Applied your change requests.