Skip to content

Commit 9d8075c

Browse files
committed
No need for fallback if it's the same as primary
1 parent 28a7ea5 commit 9d8075c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationUtilities.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ protected static void serializeNotification(SharedPreferences prefs, Notificatio
9696
byte[] bytes = data.toByteArray();
9797
serialized = Base64.encodeToString(bytes, 0, bytes.length, 0);
9898
}
99-
else
99+
else {
100100
serialized = fallback;
101+
fallback = null;
102+
}
101103

102104
SharedPreferences.Editor editor = prefs.edit().clear();
103105
editor.putString(SAVED_NOTIFICATION_PRIMARY_KEY, serialized);
104-
editor.putString(SAVED_NOTIFICATION_FALLBACK_KEY, fallback);
106+
if (fallback != null)
107+
editor.putString(SAVED_NOTIFICATION_FALLBACK_KEY, fallback);
105108
editor.apply();
106109
} catch (Exception e) {
107110
Log.e(TAG_UNITY, "Failed to serialize notification", e);

0 commit comments

Comments
 (0)