Spent some more time on this and thought I would post what I found in case
anyone else is trying to integrate  Urban Airship with Mono For Android. The
JNI calls I was making were ok but I discovered when looking in the Android
Device Logging window that if I put the developmentAppKey or
developmentAppSecret as the first line in my airshipconfig.properties file
it was only reading the first entry and other item was null and was causing
my original Illegal Argument exception error. I tried a few options and
found that moving the inProduction entry to the top fixed it, not sure why
when the Java Android project is using the exact same config file without
any issues but this fixed it 

e.g.
inProduction = false
developmentAppKey = xxxxxxxxxxxxxxxx
developmentAppSecret = xxxxxxxxxxxxxxxx 
transport = c2dm
c2dmSender = [email protected]
iapEnabled = false

After this the UrbanAirship.takeOff function ran but I noticed that it was
not connecting to C2DM to get a key and not registering the APID with Urban
Airship. I found I had to enable the UrbanAirship PushManager
(PushManager.enablePush is the Java call) by using the following JNI calls
in Mono For Android and then all has worked correctly :-

// 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);

Now I have my APID registered with Urban Airship and working well. I'm not
sure why the entries had to be that way in the airshipconfig.properties but
seems to have resolved the issue. 

Just thought I'd add this if anyone is looking in the future. I also have a
small test app if anyone needed it in future to look at, just PM me.

Thanks Jon for verifying the JNI was ok, was great help as this was the
first time of using JNI and pointed me to look at other things. Also have
found using the Android Device Logging was invaluable for tracking
everything down.





--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Urban-Airship-Push-Notifications-JNIENV-tp5553668p5555652.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to