@@ -136,9 +136,13 @@ AndroidNotificationIntentData SerializeDeserializeNotification(AndroidJavaObject
136
136
{
137
137
var dataStream = new AndroidJavaObject ( "java.io.DataInputStream" , byteStream ) ;
138
138
// don't dispose notification, it is kept in AndroidNotificationIntentData
139
- var deserializedNotification = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotificationCustom" , dataStream ) ;
140
- Assert . IsNotNull ( deserializedNotification ) ;
141
- return AndroidNotificationCenter . GetNotificationData ( deserializedNotification ) ;
139
+ using ( var deserializedNotificationBuilder = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotificationCustom" , dataStream ) )
140
+ {
141
+ Assert . IsNotNull ( deserializedNotificationBuilder ) ;
142
+ var deserializedNotification = deserializedNotificationBuilder . Call < AndroidJavaObject > ( "build" ) ;
143
+ Assert . IsNotNull ( deserializedNotification ) ;
144
+ return AndroidNotificationCenter . GetNotificationData ( deserializedNotification ) ;
145
+ }
142
146
}
143
147
}
144
148
@@ -263,8 +267,10 @@ AndroidNotificationIntentData SerializeDeserializeNotification(AndroidJavaObject
263
267
if ( inBetween != null )
264
268
inBetween ( prefs ) ;
265
269
266
- var deserializedNotification = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotification" , context , prefs ) ;
270
+ var deserializedNotificationBuilder = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotification" , context , prefs ) ;
267
271
// don't dispose notification, it is kept in AndroidNotificationIntentData
272
+ Assert . IsNotNull ( deserializedNotificationBuilder ) ;
273
+ var deserializedNotification = deserializedNotificationBuilder . Call < AndroidJavaObject > ( "build" ) ;
268
274
Assert . IsNotNull ( deserializedNotification ) ;
269
275
return AndroidNotificationCenter . GetNotificationData ( deserializedNotification ) ;
270
276
}
@@ -350,7 +356,9 @@ public void OldTypeSerializedNotificationCanBedeserialized()
350
356
var serialized = parcel . Call < AndroidJavaObject > ( "marshall" ) ;
351
357
Assert . IsNotNull ( serialized ) ;
352
358
353
- var deserializedNotification = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotification" , context , serialized ) ;
359
+ var deserializedNotificationBuilder = utilsClass . CallStatic < AndroidJavaObject > ( "deserializeNotification" , context , serialized ) ;
360
+ Assert . IsNotNull ( deserializedNotificationBuilder ) ;
361
+ var deserializedNotification = deserializedNotificationBuilder . Call < AndroidJavaObject > ( "build" ) ;
354
362
Assert . IsNotNull ( deserializedNotification ) ;
355
363
var notificationData = AndroidNotificationCenter . GetNotificationData ( deserializedNotification ) ;
356
364
Assert . IsNotNull ( notificationData ) ;
0 commit comments