diff --git a/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java index 5e4e3d2ba..524ff0772 100644 --- a/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +++ b/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java @@ -151,11 +151,18 @@ protected Notification.Builder getNotificationBuilder(PendingIntent intent) { final Notification.Builder notification = new Notification.Builder(mContext) .setContentTitle(mNotificationProps.getTitle()) .setContentText(mNotificationProps.getBody()) - .setSmallIcon(mContext.getApplicationInfo().icon) .setContentIntent(intent) .setDefaults(Notification.DEFAULT_ALL) .setAutoCancel(true); + + int resourceID = mContext.getResources().getIdentifier("notification_icon", "drawable", mContext.getPackageName()); + if (resourceID != 0) { + notification.setSmallIcon(resourceID); + } else { + notification.setSmallIcon(mContext.getApplicationInfo().icon); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, diff --git a/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java b/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java index f527a5d5a..f9c858b06 100644 --- a/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java +++ b/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java @@ -2,7 +2,7 @@ package com.wix.reactnativenotifications; import android.content.Context; -import android.support.annotation.Nullable; +import android.support.annotation.NonNull; import android.support.v4.app.NotificationManagerCompat; public abstract class NotificationManagerCompatFacade { diff --git a/docs/installation.md b/docs/installation.md index 56f1aba29..968ac9788 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -183,4 +183,13 @@ To do so edit `android/build.gradle` and add: +} ``` -**Note**: As more build variants come available in the future, you will need to adjust the list (`names.contains("reactNative59")`). This is why we recommend the first solution. \ No newline at end of file +**Note**: As more build variants come available in the future, you will need to adjust the list (`names.contains("reactNative59")`). This is why we recommend the first solution. + +#### Step #6: Set your notification Icon. + +By default, the package will use your native application icon. If your icon is not notification friendly, you may have to set and use a different icon. To do this, create a notification_icon.png and add it to your drawable folders. Once that is done add the following line to your AndroidManifest.xml + +```diff ++ +``` +