Ejemplo n.º 1
0
        public void ScheduleJob(View v)
        {
            if (!EnsureTestService())
            {
                return;
            }
            var builder = new JobInfo.Builder(kJobId++, serviceComponent);

            var delay = delayEditText.Text;

            if (delay != null && !TextUtils.IsEmpty(delay))
            {
                builder.SetMinimumLatency(long.Parse(delay) * 1000);
            }
            var deadline = deadlineEditText.Text;

            if (deadline != null && !TextUtils.IsEmpty(deadline))
            {
                builder.SetOverrideDeadline(long.Parse(deadline) * 1000);
            }
            bool requiresUnmetered       = wiFiConnectivityRadioButton.Checked;
            bool requiresAnyConnectivity = anyConnectivityRadioButton.Checked;

            if (requiresUnmetered)
            {
                builder.SetRequiredNetworkCapabilities(NetworkTypeValue.Unmetered);
            }
            else if (requiresAnyConnectivity)
            {
                builder.SetRequiredNetworkCapabilities(NetworkTypeValue.Any);
            }
            builder.SetRequiresDeviceIdle(requiresIdleCheckbox.Checked);
            builder.SetRequiresCharging(requiresChargingCheckBox.Checked);

            testService.ScheduleJob(builder.Build());
        }
Ejemplo n.º 2
0
		public void ScheduleJob (View v)
		{
			if (!EnsureTestService ()) {
				return;
			}
			var builder = new JobInfo.Builder (kJobId++, serviceComponent);

			var delay = delayEditText.Text;
			if (delay != null && !TextUtils.IsEmpty (delay)) {
				builder.SetMinimumLatency (long.Parse (delay) * 1000);
			}
			var deadline = deadlineEditText.Text;
			if (deadline != null && !TextUtils.IsEmpty (deadline)) {
				builder.SetOverrideDeadline (long.Parse (deadline) * 1000);
			}
			bool requiresUnmetered = wiFiConnectivityRadioButton.Checked;
			bool requiresAnyConnectivity = anyConnectivityRadioButton.Checked;
			if (requiresUnmetered) {
				builder.SetRequiredNetworkCapabilities (NetworkTypeValue.Unmetered);
			} else if (requiresAnyConnectivity) {
				builder.SetRequiredNetworkCapabilities (NetworkTypeValue.Any);
			}
			builder.SetRequiresDeviceIdle (requiresIdleCheckbox.Checked);
			builder.SetRequiresCharging (requiresChargingCheckBox.Checked);

			testService.ScheduleJob (builder.Build ());
		}