Skip to content

Commit f0c3d80

Browse files
committed
Add comment for safety
1 parent c704e49 commit f0c3d80

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
import static com.unity.androidnotifications.UnityNotificationManager.TAG_UNITY;
3434

3535
public class UnityNotificationUtilities {
36+
/*
37+
We serialize notifications and save them to shared prefs, so that if app is killed, we can recreate them.
38+
The serialized BLOB starts with a four byte magic number descibing serialization type, followed by an integer version.
39+
IMPORTANT: IF YOU DO A CHANGE THAT AFFECTS THE LAYOUT, BUMP THE VERSION, AND ENSURE OLD VERSION STILL DESERIALIZES. ADD TEST.
40+
In real life app can get updated having old serialized notifications present, so we should be able to deserialize them.
41+
*/
3642
// magic stands for "Unity Mobile Notifications Notification"
3743
private static final byte[] UNITY_MAGIC_NUMBER = new byte[] { 'U', 'M', 'N', 'N'};
3844
private static final byte[] UNITY_MAGIC_NUMBER_PARCELLED = new byte[] { 'U', 'M', 'N', 'P'};

0 commit comments

Comments
 (0)