aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
245 stars 114 forks source link

customizable notification icon #2599

Open niihofutoshi opened 11 months ago

niihofutoshi commented 11 months ago

Before opening, please confirm:

Language and Async Model

Kotlin - Coroutines

Amplify Categories

Notifications

Gradle script dependencies

```groovy // Put output below this line ```

Environment information

``` # Put output below this line ```

Please include any relevant guides or documentation you're referencing

No response

Describe the feature request

customizable notification icon

pinpoint sdk use ic_launcher_foreground that is hardcoded in the code, so it cannot be customized on the app side. There are cases where a different icon is needed for notifications, so I would like the ability to pass a different icon.

Initialization steps (if applicable)

No response

Code Snippet

// Put your code below this line.

amplifyconfiguration.json

No response

GraphQL Schema

```graphql // Put your schema below this line ```

Additional information and screenshots

No response

mattcreaser commented 11 months ago

Thanks for the request @niihofutoshi. Could you expand a little bit on your use case here so that we can fully understand the ask? How would you decide which icon to show?

niihofutoshi commented 11 months ago

@mattcreaser Thank you for your reply!

I would like to set a notification icon like Firebase Cloud Messaging. In Firebase Cloud Messaging, you can set the notification icon by declaring it in the manifest.

<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
     See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_ic_notification" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
     notification message. See README(https://goo.gl/6BKBk7) for more. -->
<meta-data
    android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/colorAccent" />

https://firebase.google.com/docs/cloud-messaging/android/client?hl=ja

This implementation may be helpful https://github.com/firebase/firebase-android-sdk/tree/master/firebase-messaging

ClemPalf commented 2 months ago

Hello everyone, I also recently tried to update the Android notification_icon, whitout succes. Like @niihofutoshi pointed out, it seems you hard-coded it with setSmallIcon(R.drawable.ic_launcher_foreground)

Is there a way this value could be set to the one provided in the manifest ? (at meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_ic_notification" )

Regards,