rdelrosario / xamarin-plugins

Cross platform Xamarin & Windows plugins for PCLs
MIT License
179 stars 161 forks source link

Push Notifications: Missing Method Exception in PushNotificationsReceiver.cs #8

Closed ghost closed 9 years ago

ghost commented 9 years ago

I tried adding the PushNotification plugin to an Xamarin.Android project that targets API level 21 and when I try to call CrossPushNotification.Current.Register() I get this exception:

[MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.CallStaticObjectMethod'.]
    PushNotification.Plugin.PushNotificationsReceiver.OnReceive(Android.Content.Context,Android.Content.Intent) in c:\xamarin-plugins\PushNotification\PushNotification\PushNotification.Plugin.Android\PushNotificationsReceiver.cs:34
    Android.Content.BroadcastReceiver.n_OnReceive_Landroid_content_Context_Landroid_content_Intent_(intptr,intptr,intptr,intptr) in /Users/builder/data/lanes/1353/86274adf/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Content.BroadcastReceiver.cs:334
    at (wrapper dynamic-method) object.cf39052a-7755-4cfc-bb54-e69d5073bce6 (intptr,intptr,intptr,intptr) <IL 0x0001d, 0x00027>

I'm not entirely sure what might be causing this issue, but I can't seem to find a way around it.

rdelrosario commented 9 years ago

Do you you have all the Android SDK Manager packages updated?

Seems to be crashing on the call to StartWakefulService. This uses android.support.v4 library, make sure you have it included and updated in your project.

Let me know if helps

ghost commented 9 years ago

Thanks! That worked.