コード例 #1
0
        public override StartCommandResult OnStartCommand(Intent intent, Android.App.StartCommandFlags flags, int startId)
        {
            var callback = (Messenger)intent.GetParcelableExtra("messenger");
            var m        = Message.Obtain();

            m.What = MainActivity.MessageServiceObj;
            m.Obj  = this;
            try {
                callback.Send(m);
            } catch (RemoteException e) {
                Log.Error(Tag, e, "Error passing service object back to activity.");
            }
            return(StartCommandResult.NotSticky);
        }
コード例 #2
0
        public override StartCommandResult OnStartCommand(Intent intent, Android.App.StartCommandFlags flags, int startId)
        {
            var callback = (Messenger)intent.GetParcelableExtra("messenger");
            var m        = Message.Obtain();

            m.What = MainActivity.MESSAGE_SERVICE_CLEAR_PAYMENTS;
            m.Obj  = this;
            try
            {
                callback.Send(m);
            } catch (RemoteException e)
            {
                Debug.WriteLine(e);
            }
            return(StartCommandResult.NotSticky);
        }
コード例 #3
0
        public override StartCommandResult OnStartCommand(Intent intent, Android.App.StartCommandFlags flags, int startId)
        {
            var callback = (Messenger)intent.GetParcelableExtra("messenger");
            var m        = Message.Obtain();

            m.Obj = this;
            try
            {
                callback.Send(m);
            }
            catch (RemoteException e)
            {
                Log.Error(Tag, e, "Error passing service object back to activity.");
            }



            Toast.MakeText(this, "OnStartCommand", ToastLength.Short).Show();
            return(StartCommandResult.Sticky);
        }
コード例 #4
0
 public override Android.App.StartCommandResult OnStartCommand(Android.Content.Intent intent, Android.App.StartCommandFlags flags, int startId)
 {
     if (intent != null)
     {
         string action = intent.Action;
         if (Constants.ActionDismiss.Equals(action))
         {
             // We need to dismiss the wearable notification. We delete the DataItem that created the notification to inform the wearable.
             int notificationId = intent.GetIntExtra(Constants.KeyNotificationId, -1);
             if (notificationId == Constants.BothId)
             {
                 DismissWearableNotification(notificationId);
             }
         }
     }
     return(base.OnStartCommand(intent, flags, startId));
 }
コード例 #5
0
ファイル: MyService.cs プロジェクト: Gluxur/GBSchedule
 public override StartCommandResult OnStartCommand(Intent intent, Android.App.StartCommandFlags flags, int startId)
 {
     return(StartCommandResult.Sticky);
 }