DefaultPushNotificationHandler.OnReceive error under Android (both 7.1.1 & 8.1.0)
See original GitHub issueVersion Number of Plugin: 2.3.0 Device Tested On: Google Pixel XL (Android 8.1.0) Simulator Tested On: AVD for Nexus 6, (Android 7.1.1) Version of VS: 15.5.6 Version of Xamarin: 2.5.0.122203 Versions of other things you are using:
- Xamarin.Android.Support.v4: 26.1.0.1,
- All other Xamarin.Android.Support libs are version 25.3.1
Hi,
I’m implementing your plugin for a solution in both iOS and Android. iOS works pretty fine, no issues there. But on Android I have null references when I receive a notification from FCM. I’ve set up everything as in your guides/examples using the DefaultPushNotificationHandler. Now everything is fine until i receive the notification under Android:
Steps: Your setup as described in your tutorial steps. Also using the methods from Application.IActivityLifecycleCallbacks in Android’s MainApplication.cs
Expected Behavior: To pop up a notification
Actual Behavior: Error in method CrossFirebasePushNotification.Current.NotificationHandler.OnReceived(p.Data);
03-09 13:21:23.471 I/MonoDroid(17066): UNHANDLED EXCEPTION: 03-09 13:21:23.480 I/MonoDroid(17066): System.MissingMethodException: Method ‘Android.Support.V4.App.NotificationCompat/Builder…ctor’ not found. 03-09 13:21:23.481 I/MonoDroid(17066): at Plugin.FirebasePushNotification.PNFirebaseMessagingService.OnMessageReceived (Firebase.Messaging.RemoteMessage message) [0x001d3] in C:\Plugins\FirebasePushNotification\src\Plugin.FirebasePushNotification.Android\PNFirebaseMessagingService.cs:64 03-09 13:21:23.481 I/MonoDroid(17066): at Firebase.Messaging.FirebaseMessagingService.n_OnMessageReceived_Lcom_google_firebase_messaging_RemoteMessage_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_message) [0x0000f] in <c9c78f979e004ecbb4a1706c3d5c466b>:0 03-09 13:21:23.481 I/MonoDroid(17066): at (wrapper dynamic-method) System.Object:eefe38d2-cd7d-44f0-8cfa-a2ed5f5d3ebd (intptr,intptr,intptr)
Code snippet:
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { try { CrossFirebasePushNotification.Current.NotificationHandler.OnReceived(p.Data); } catch (Exception ex) { Debug.WriteLine(ex.Message); } };
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I’ve had different versions of the Android support libs. Made them all same version and it’s all good now. Issue solved, thank you very much!
You need AppCompat 26.0.2 is a dependency of the plugin