question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DefaultPushNotificationHandler.OnReceive error under Android (both 7.1.1 & 8.1.0)

See original GitHub issue

Version 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
c0rnh0li0commented, Mar 12, 2018

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!

0reactions
rdelrosariocommented, Mar 9, 2018

You need AppCompat 26.0.2 is a dependency of the plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade from gradle 8.0.2 to 8.1.0 breaks GitHub builds
It seems to be working fine when building from Android Studio on Windows 11 but it broke my GitHub builds. Here is the...
Read more >
Android Studio Suddenly started to display unable ...
Open your android SDK manager (from C:\Users\youruseraccount\AppData\Local\Android\sdk) and update following to latest versions in,.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found