OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
104
stars
50
forks
source link
NullReferenceException on opening notification on Xamarin.Android 4.0.0-beta1 #263
I am sending a simple notification from OneSignal portal. This notification consists of only title and message, no images, icons, buttons and other additional data.
When the notification is delivered to a device, I open it and get the NullReferenceException in Com.OneSignal.NativeConversion.NotificationToXam method.
I opened NativeConversion.cs file, and realized that there is no null check for notification.AdditionalData, notification.GroupedNotifications, notification.ActionButtons, and also notification.GetBackgroundImageLayout()
Environment
Xamarin.Android
Com.OneSignal 4.0.0-beta1 from Nuget
Steps to Reproduce Issue:
Add version 4.0.0-beta1 of the Xamarin SDK to your project
Initialize the SDK with your App ID
Attempt to receive a simple push notification with only title and message
at Com.OneSignal.NativeConversion.NotificationToXam (Com.OneSignal.Android.OSNotification notification) [0x001b7] in /Users/tanay/Desktop/Xamarin_SDK/OneSignal_Xamarin-4_0_0/OneSignal-Xamarin-SDK/Com.OneSignal.Android/Utilities/NativeConversion.cs:11
at Com.OneSignal.NativeConversion.NotificationOpenedResultToXam (Com.OneSignal.Android.OSNotificationOpenedResult result) [0x00000] in /Users/tanay/Desktop/Xamarin_SDK/OneSignal_Xamarin-4_0_0/OneSignal-Xamarin-SDK/Com.OneSignal.Android/Utilities/NativeConversion.cs:71
at Com.OneSignal.OneSignalImplementation+OSNotificationOpenedHandler.NotificationOpened (Com.OneSignal.Android.OSNotificationOpenedResult notificationOpenedResult) [0x00000] in /Users/tanay/Desktop/Xamarin_SDK/OneSignal_Xamarin-4_0_0/OneSignal-Xamarin-SDK/Com.OneSignal.Android/OneSignalCallbacks.cs:106
at Com.OneSignal.Android.OneSignal+IOSNotificationOpenedHandlerInvoker.n_NotificationOpened_Lcom_onesignal_OSNotificationOpenedResult_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_p0) [0x00011] in /Users/tanay/Desktop/Xamarin_SDK/OneSignal_Xamarin-4_0_0/OneSignal-Xamarin-SDK/OneSignal.Android.Binding/obj/Release/generated/src/Com.OneSignal.Android.OneSignal.cs:1334
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.9(intptr,intptr,intptr)
Description
I am sending a simple notification from OneSignal portal. This notification consists of only title and message, no images, icons, buttons and other additional data.
When the notification is delivered to a device, I open it and get the
NullReferenceException
inCom.OneSignal.NativeConversion.NotificationToXam
method.I opened NativeConversion.cs file, and realized that there is no null check for
notification.AdditionalData
,notification.GroupedNotifications
,notification.ActionButtons
, and alsonotification.GetBackgroundImageLayout()
Environment
Steps to Reproduce Issue:
Stacktrace