[mono-android] Trying to Call PushManager.share().setIntentReciver(IntentReceiver.class)

Jonathan Pryor jonp at xamarin.com
Wed Oct 3 14:47:50 UTC 2012


On Oct 3, 2012, at 6:12 AM, Adrian at Gravity <adrian at creategravity.com> wrote:
> Tried the following but getting 'No such method'
> 
> IntPtr ip_PushManager = JNIEnv.FindClass("com/urbanairship/push/PushManager");
> 
>                IntPtr ip_setReciver = JNIEnv.GetMethodID(ip_PushManager, "shared().setIntentReceiver", "(Landroid/app/Class)V");

You have to lookup each method individually; JNIEnv doesn't support looking up arbitrary expressions:

	IntPtr ip_PushManager_shared = JNIEnv.GetMethodID(ip_PushManager, "shared", "...");
	IntPtr lrefShared = JNIEnv.CallStaticObjectMethod(ip_PushManager, ip_PushManager_shared);
	IntPtr ip_PushManager_setIntentReceiver = JNIEnv.GetMethodID(ip_PushManager, "setIntentReceiver", "(Landroid/app/Class)V");
	JNIEnv.CallVoidMethod(lrefShared, ip_PushManager_setIntentReceiver, new JValue(Java.Lang.Class.FromType(typeof(whatever)));
	JNIEnv.DeleteLocalRef(lrefShared);

 - Jon



More information about the Monodroid mailing list