Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 629c532

Browse files
committed
Default using drawable as Android small icon
1 parent 1402265 commit 629c532

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,12 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
319319
String smallIcon = bundle.getString("smallIcon");
320320

321321
if (smallIcon != null && !smallIcon.isEmpty()) {
322-
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
322+
smallIconResId = res.getIdentifier(smallIcon, "drawable", packageName);
323+
if (smallIconResId == 0) {
324+
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
325+
}
323326
} else if(smallIcon == null) {
324-
smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
327+
smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
325328
}
326329

327330
if (smallIconResId == 0) {
@@ -341,9 +344,9 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
341344
String largeIcon = bundle.getString("largeIcon");
342345

343346
if (largeIcon != null && !largeIcon.isEmpty()) {
344-
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
347+
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
345348
} else if(largeIcon == null) {
346-
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
349+
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
347350
}
348351

349352
// Before Lolipop there was no large icon for notifications.

0 commit comments

Comments
 (0)