Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 10 additions & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
**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
+<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable notification_icon" />
```