public override void OnCreate()
        {
            base.OnCreate();

            if (osDispatcher == null) osDispatcher = new AndroidDispatcher();
            osDispatcher.ServiceCallback = this;

            Log.Info("SharpXmppDemo", this.Class.ToString() + " I'm being created :)");
        }
 /// <summary>
 /// Create the service, setting the osDispatcher object
 /// </summary>
 public BackgroundService()
     : base("BackgroundService")
 {
     if (xmppConnection == null)
     {
         if (osDispatcher == null) osDispatcher = new AndroidDispatcher();
         osDispatcher.ServiceCallback = this;
     }
 }
Exemple #3
0
        public override void OnCreate()
        {
            base.OnCreate();

            if (osDispatcher == null)
            {
                osDispatcher = new AndroidDispatcher();
            }
            osDispatcher.ServiceCallback = this;

            Log.Info("SharpXmppDemo", this.Class.ToString() + " I'm being created :)");
        }
Exemple #4
0
 /// <summary>
 /// Create the service, setting the osDispatcher object
 /// </summary>
 public BackgroundService()
     : base("BackgroundService")
 {
     if (xmppConnection == null)
     {
         if (osDispatcher == null)
         {
             osDispatcher = new AndroidDispatcher();
         }
         osDispatcher.ServiceCallback = this;
     }
 }
Exemple #5
0
        protected override void OnHandleIntent(Intent intent)
        {
            if (XmppConnection != null)
            {
                if (osDispatcher == null)
                {
                    osDispatcher = new AndroidDispatcher();
                }
                osDispatcher.ServiceCallback = this;
            }

            // If service is restarted and no intent provided, the default action is to make a new connection to the server
            if (intent == null)
            {
                Log.Info("SharpXmppDemo", this.Class.ToString() + " StartSticky reinitiated Intent ");

                //Connect by default
                var newIntent = new Intent(ServiceAction.CONNECT.ToString());
                connect(newIntent);
                return;
            }

            String action   = intent.Action;
            Intent response = null;

            Log.Info("SharpXmppDemo", this.Class.ToString() + " Processing action " + intent.Action.ToString());

            if (action.Equals(ServiceAction.CONNECT.ToString()))
            {
                response = connect(intent);
            }

            if (action.Equals(ServiceAction.INIT.ToString()))
            {
                response = init(intent);
            }

            if (action.Equals(ServiceAction.SENDMESSAGE.ToString()))
            {
                response = sendMessage(intent);
            }
            // Due to activation via an alarm
            WakefulXmppReceiver.CompleteWakefulIntent(intent);
        }
        protected override void OnHandleIntent(Intent intent)
        {
            if (XmppConnection != null)
            {
                if (osDispatcher == null) osDispatcher = new AndroidDispatcher();
                osDispatcher.ServiceCallback = this;
            }

            // If service is restarted and no intent provided, the default action is to make a new connection to the server
            if (intent == null)
            {
                Log.Info("SharpXmppDemo", this.Class.ToString() + " StartSticky reinitiated Intent ");

                //Connect by default
                var newIntent = new Intent(ServiceAction.CONNECT.ToString());
                connect(newIntent);
                return;
            }

            String action = intent.Action;
            Intent response = null;

            Log.Info("SharpXmppDemo", this.Class.ToString() + " Processing action " + intent.Action.ToString());

            if (action.Equals(ServiceAction.CONNECT.ToString()))
            {
                response = connect(intent);
            }

            if (action.Equals(ServiceAction.INIT.ToString()))
            {
                response = init(intent);
            }

            if (action.Equals(ServiceAction.SENDMESSAGE.ToString()))
            {
                response = sendMessage(intent);
            }
            // Due to activation via an alarm
            WakefulXmppReceiver.CompleteWakefulIntent(intent);
        }