Hi all

I am trying to get my push notifications working in mono for android (using
urban airship). So far I have been able to call TakeOff() and EnablePush()
using JNIEnv, but have been unable to successfully call
PushManager.share().setIntentReciever.

This is my code so far:

//_____________________________
                // Get the airship config class
                IntPtr ip_airshipConfigOptions =
JNIEnv.FindClass("com/urbanairship/AirshipConfigOptions");

                if (ip_airshipConfigOptions == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Counldn't find java
class !");
                }

                //__________________________________________________
                // Get the loadDefaults method from the config class
                IntPtr methodId =
JNIEnv.GetStaticMethodID(ip_airshipConfigOptions, "loadDefaultOptions",
"(Landroid/content/Context;)Lcom/urbanairship/AirshipConfigOptions;");

                if (methodId == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Couldn't find java
class !");
                }

               
//________________________________________________________________
                // Call the loadDefaultOptions method passing in this app
instance
                var methodPtr =
JNIEnv.CallStaticObjectMethod(ip_airshipConfigOptions, methodId, new
JValue(this));

                //________________________
                // Get the UAirship class
                IntPtr ip_uairship =
JNIEnv.FindClass("com/urbanairship/UAirship");

                if (ip_uairship == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Couldn't find java
class !");
                }

                //___________________________________________
                // Get takeOff method with configoption param
                IntPtr methodId2 = JNIEnv.GetStaticMethodID(ip_uairship,
"takeOff",
"(Landroid/app/Application;Lcom/urbanairship/AirshipConfigOptions;)V");

               
//___________________________________________________________________________________________
                // Call UAirship.takeOff(this, options). Not sure if these
parameters are specified correctly 
                JNIEnv.CallStaticVoidMethod(ip_uairship, methodId2, new
JValue(this), new JValue(methodPtr));

                //________________________________________
                // Enable Push in Urban Airship Pushmanager     
                IntPtr ip_pushmanager =
JNIEnv.FindClass("com/urbanairship/push/PushManager");
                IntPtr ip_enablePush =
JNIEnv.GetStaticMethodID(ip_pushmanager, "enablePush", "()V");
                JNIEnv.CallStaticVoidMethod(ip_pushmanager, ip_enablePush);

Does anyone know firstly how I get a pointer to the setIntentReciver method
using JNIEnv? I have tried a few different ways to try access the shared
class but can't seem to find it.

Any help appreciated!



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Trying-to-Call-PushManager-share-setIntentReciver-IntentReceiver-class-tp5712058.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to