Exemplo n.º 1
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (NebliDex_Service != null)
            {
                return(StartCommandResult.Sticky);
            }                        //Do not reload the program again
            NebliDex_Service = this; // Reference itself so it can be used by other members
            RegisterForegroundService();

            Task.Run(() => Start());  // The program will initialize in another thread

            return(StartCommandResult.Sticky);
        }
Exemplo n.º 2
0
        public override void OnDestroy()
        {
            // Remove the notification from the status bar.
            // And close the service
            var notificationManager = (NotificationManager)GetSystemService(NotificationService);

            notificationManager.Cancel(FORSERVICE_NOTIFICATION_ID);
            StopSelf();
            StopForeground(true);

            base.OnDestroy();
            NebliDex_Service = null;
            ExitProgram();
        }
Exemplo n.º 3
0
		void Share (Service service, Button shareButton)
		{
			Item item = new Item {
				Text = "I'm sharing great things using Xamarin!",
				Links = new List<Uri> {
					new Uri ("http://xamarin.com"),
				},
			};

			Intent intent = service.GetShareUI (this, item, shareResult => {
				shareButton.Text = service.Title + " shared: " + shareResult;
			});

			StartActivity (intent);
		}
Exemplo n.º 4
0
 public MyBinder(Service s)
 {
     serv = s;
 }