Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layouts.local_service_broadcaster);

            // This is where we print the data we get back.
            TextView callbackData = (TextView)FindViewById(R.Ids.callback);

            // Put in some initial text.
            callbackData.SetText("No broadcast received yet");

            // We use this to send broadcasts within our local process.
            mLocalBroadcastManager = LocalBroadcastManager.GetInstance(this);

            // We are going to watch for interesting local broadcasts.
            IntentFilter filter = new IntentFilter();

            filter.AddAction(ACTION_STARTED);
            filter.AddAction(ACTION_UPDATE);
            filter.AddAction(ACTION_STOPPED);
            mReceiver = new MyBroadcastReceiver(callbackData);

            mLocalBroadcastManager.RegisterReceiver(mReceiver, filter);

            // Watch for button clicks.
            Button button = (Button)FindViewById(R.Ids.start);

            button.Click += (o, e) => StartService(new Intent(this, typeof(LocalService)));
            button        = (Button)FindViewById(R.Ids.stop);
            button.Click += (o, e) => StopService(new Intent(this, typeof(LocalService)));
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layout.local_service_broadcaster);

            // This is where we print the data we get back.
            TextView callbackData = (TextView)FindViewById(R.Id.callback);

            // Put in some initial text.
            callbackData.Text = ("No broadcast received yet");

            // We use this to send broadcasts within our local process.
            mLocalBroadcastManager = LocalBroadcastManager.GetInstance(this);

            // We are going to watch for interesting local broadcasts.
            IntentFilter filter = new IntentFilter();
            filter.AddAction(ACTION_STARTED);
            filter.AddAction(ACTION_UPDATE);
            filter.AddAction(ACTION_STOPPED);
            mReceiver = new MyBroadcastReceiver(callbackData);
            
            mLocalBroadcastManager.RegisterReceiver(mReceiver, filter);

            // Watch for button clicks.
            Button button = (Button)FindViewById(R.Id.start);
            button.Click += (o,e) => StartService(new Intent(this, typeof(LocalService)));
            button = (Button)FindViewById(R.Id.stop);
            button.Click += (o,e) => StopService(new Intent(this, typeof(LocalService)));
        }
Exemplo n.º 3
0
        void Probar_OnClick(object sender, EventArgs e)
        {
            prefmodel.SetNumberString(tb_numbers.Text);
            prefmodel.DoSilence = this.chkb_dosilence.Checked;
            prefmodel.DoMMS     = this.chkb_MMS.Checked;
            prefmodel.DoMessage = this.chkb_Message.Checked;
            prefmodel.DoCall    = this.chkb_LLamar.Checked;
            if (!prefmodel.IsValidNumbersString())
            {
                Toast.MakeText(this, "Secuencia de Numeros Incorrecta", ToastLength.Long);
            }
            else
            {
                Toast.MakeText(this, "Preferencias Guardadas", ToastLength.Long);

                tone_detected_reciver = new ToneDetectedReciver();
                LocalBroadcastManager bc_mngr = LocalBroadcastManager.GetInstance(this);
                bc_mngr.RegisterReceiver(tone_detected_reciver, new IntentFilter("DroidVigia.DroidVigia.DroidVigia.ToneDetected"));
                var intent = new Intent("DroidVigia.DroidVigia.DroidVigia.ToneDetected");
                intent.PutExtra("message", "Prueba de Envio");
                bc_mngr.SendBroadcastSync(intent);
                bc_mngr.UnregisterReceiver(tone_detected_reciver);
                tone_detected_reciver = null;
            }
        }
        protected override void OnResume()
        {
            base.OnResume();
            IntentFilter broadcastFilter = new IntentFilter("LOCAL_ACTION");

            broadcastResponseReceiver = new BroadcastResponseReceiver(this);
            LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.GetInstance(this);

            localBroadcastManager.RegisterReceiver(broadcastResponseReceiver, broadcastFilter);
        }
Exemplo n.º 5
0
        public override void OnResume()
        {
            base.OnResume();

            // Register a local broadcast manager to listen for ACTION_UPDATE_CHANNEL
            LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.GetInstance(Context);

            // Use local broadcast manager to receive registration events to update the channel
            IntentFilter channelUpdateFilter = new IntentFilter();

            channelUpdateFilter.AddAction(UrbanAirshipReceiver.ACTION_CHANNEL_UPDATED);
            localBroadcastManager.RegisterReceiver(channelIdUpdateReceiver, channelUpdateFilter);

            RefreshChannelId();
        }
Exemplo n.º 6
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            container  = view as ConstraintLayout;
            viewFinder = container.FindViewById <PreviewView>(Resource.Id.view_finder);

            // Initialize our background executor
            cameraExecutor = Java.Util.Concurrent.Executors.NewSingleThreadExecutor();

            volumeDownReceiver = new VolumeDownReceiver(this);

            broadcastManager = LocalBroadcastManager.GetInstance(view.Context);

            // Set up the intent filter that will receive events from our main activity
            var filter = new IntentFilter();

            filter.AddAction(MainActivity.KeyEventAction);
            broadcastManager.RegisterReceiver(volumeDownReceiver, filter);

            // Every time the orientation of device changes, update rotation for use cases
            displayManager.RegisterDisplayListener(this, null);

            // Determine the output directory
            outputDirectory = MainActivity.GetOutputDirectory(RequireContext());

            // Wait for the views to be properly laid out
            viewFinder.Post(() =>
            {
                // Keep track of the display in which this view is attached
                displayId = viewFinder.Display.DisplayId;

                // Build UI controls
                UpdateCameraUi();

                // Set up the camera and its use cases
                SetUpCamera();
            });
        }