Thanks for the reply Jonathan!
The push notifications are now working, but I am not getting the behavior I
expected. When I send a test push all that happens is the message is
displayed in my notifications.
My BroadcastReciever class is not being fired with the details of the
message.
This is the line I set the intent receiver:
//_________________________________________________________________________________
// Set the intent reciever passing in a new instance of the my
IntentReciever class
JNIEnv.CallVoidMethod(ip_class, ip_setIntent, new
JValue(Java.Lang.Class.FromType(typeof(IntentReciever))));
But my IntentReciever is not called whenever the push is sent down, here is
the code of my IntentReciever. It's not doing much at the moment, just
logging the message:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;
namespace com.gravity.galgorm.ua
{
public class IntentReciever : BroadcastReceiver
{
private Context context;
public override void OnReceive(Context context, Intent intent)
{
Console.WriteLine("* ONRECIEVE *");
this.context = context;
if
(intent.Action.Equals("com.google.android.c2dm.intent.REGISTRATION"))
{
handleRegistration(context, intent);
}
else if
(intent.Action.Equals("com.google.android.c2dm.intent.RECEIVE"))
{
handleMessage(context, intent);
}
}
private void handleRegistration(Context context, Intent intent)
{
try
{
Console.WriteLine("* handleRegistration *");
String registration =
intent.GetStringExtra("registration_id");
if (intent.GetStringExtra("error") != null)
{
// Error
}
else if (registration != null)
{
// Success
}
}
catch
{
}
}
private void handleMessage(Context context, Intent intent)
{
Log.Debug("c2dm", "New Notification Recieved: " +
intent.Action.ToString());
}
}
}
Am I confused about how this is supposed to work? Should OnRecieve not be
fired when I send my message?
Adrian
--
View this message in context:
http://mono-for-android.1047100.n5.nabble.com/Trying-to-Call-PushManager-share-setIntentReciver-IntentReceiver-class-tp5712058p5712064.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