protected override void OnPause()
        {
            base.OnPause();

            try
            {
                wakeLock.Release();
            }
            catch { }

            if (null != MobileGlobals.NotifyPauseResume)
            {
                MobileGlobals.NotifyPauseResume();
            }
        }
Exemple #2
0
 public void StopRecordingVideo()
 {
     // Workaround for https://github.com/googlesamples/android-Camera2Video/issues/2
     CloseCameraVideo();
     OpenCamera(mTextureView.Width, mTextureView.Height);
     wakeLock?.Release();
     Video?.Invoke(this, videoFilePath);
 }
Exemple #3
0
            public override void OnPause()
            {
                base.OnPause();

                if (WakeLock.IsHeld == true)
                {
                    WakeLock.Release( );
                }

                IsActive = false;
            }
Exemple #4
0
        private void WakeUpScreenAsync()
        {
            PowerManager powerManager = (PowerManager)Android.App.Application.Context.GetSystemService(Context.PowerService);
            bool         isScreenOn   = powerManager.IsInteractive;

            if (!isScreenOn)
            {
                WakeLock wakeLock = powerManager.NewWakeLock(WakeLockFlags.ScreenDim | WakeLockFlags.AcquireCausesWakeup, "StackQAXFNotification");
                wakeLock.Acquire();
                wakeLock.Release();
            }
        }
Exemple #5
0
        public override void OnDestroy()
        {
            // Stop the handler.
            handler.RemoveCallbacks(runnable);

            // Remove the notification from the status bar.
            var notificationManager = (NotificationManager)GetSystemService(NotificationService);

            notificationManager.Cancel(NOTIFICATION_SERVICE_ID);

            isStarted = false;
            wakeLock.Release();
            base.OnDestroy();
        }
        void UpdateReceivedData(byte[] data)
        {
            try
            {
                ConnectivityManager ConnectivityManager = (ConnectivityManager)Application.Context.GetSystemService(Context.ConnectivityService);
                NetworkInfo         connection          = ConnectivityManager.ActiveNetworkInfo;
                if (connection != null && connection.IsConnected && CrossConnectivity.Current.IsConnected)
                {
                    var message = HexDump.DumpHexString(data) + "\n\n";
                    dumpTextView.Append(message);
                    scrollView.SmoothScrollTo(0, dumpTextView.Bottom);
                }
                else
                {
                    if (wake.IsHeld && wifilock.IsHeld)
                    {
                        wake.Release();     //libera wakeLock
                        wifilock.Release(); //libera wifiLock
                    }
                    activateSleep = false;
                    PowerManager pwm = (PowerManager)GetSystemService(Context.PowerService);
                    WakeLock     wkl = pwm.NewWakeLock(WakeLockFlags.Full | WakeLockFlags.AcquireCausesWakeup | WakeLockFlags.OnAfterRelease, "wakeup device");
                    wkl.Acquire();
                    wkl.Release();

                    Finish();
                    intent = PackageManager.GetLaunchIntentForPackage("com.flexolumens.MonitorInteligente");
                    StartActivity(intent);
                    //OnDestroy();
                }

                if (activateSleep == true && (connection != null && connection.IsConnected) && CrossConnectivity.Current.IsConnected)
                {
                    wake.Acquire();
                    wifilock.Acquire();
                    activateSleep = false;
                    intento       = PackageManager.GetLaunchIntentForPackage("com.ssaurel.lockdevice");
                    StartActivity(intento);
                    //if (!wifi.IsWifiEnabled)
                    //{
                    //wifi.SetWifiEnabled(true);
                    //}
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }
        }
Exemple #7
0
            public override void OnPause( )
            {
                base.OnPause( );

                FragmentReady = false;

                WakeLock.Release( );

                // if we don't support full widescreen, enable the reveal button
                if (MainActivity.SupportsLandscapeWide( ) == false)
                {
                    ParentTask.NavbarFragment.EnableSpringboardRevealButton(true);

                    // also force the orientation to portait
                    Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
                }
            }
        public override void OnDestroy()
        {
            AppWrapper.Service = null;

            if (wl != null)
            {
                wl.Release();
            }

            if (dataSyncTimer != null)
            {
                dataSyncTimer.Change(Timeout.Infinite, Timeout.Infinite);
            }

            LocationDataManager.Instance.StopLocationRequest();

            StopForeground(true);
        }
Exemple #9
0
                public override void OnPause()
                {
                    // when we're being backgrounded, release our lock so we don't force
                    // the device to stay on
                    base.OnPause( );

                    FragmentReady = false;

                    WakeLock.Release( );

                    // if we don't support full widescreen, enable the reveal button
                    if (MainActivity.SupportsLandscapeWide( ) == false)
                    {
                        ParentTask.NavbarFragment.EnableSpringboardRevealButton(true);

                        // also force the orientation to portait
                        Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
                    }

                    ShutdownNotes(null);
                }
Exemple #10
0
        /// <summary>
        /// Called as part of the activity lifecycle when an activity is going into
        /// the background, but has not (yet) been killed.
        /// </summary>
        public override void OnPause()
        {
            base.OnPause();

            WifiLock.Release();
            WakeLock.Release();

            PlayerView.HideController();

            if (VideoPlayer != null)
            {
                VideoPlayer.PlayWhenReady = false;

                try
                {
                    LastUrl      = Data.FromJson <string>();
                    LastPosition = VideoPlayer.CurrentPosition;
                    var duration = VideoPlayer.Duration;

                    //
                    // Times our in milliseconds.
                    //
                    if (LastPosition > (duration - 300000) || LastPosition < 60000)
                    {
                        LastUrl      = null;
                        LastPosition = null;
                    }

                    AutoResumePosition = VideoPlayer.CurrentPosition;
                }
                catch
                {
                    LastUrl      = null;
                    LastPosition = null;
                }

                VideoPlayer       = null;
                PlayerView.Player = null;
            }
        }
Exemple #11
0
 protected override void OnPause()
 {
     wakeLock.Release();
     base.OnPause();
     RenderManager.Pause();
 }
Exemple #12
0
 protected override void OnPause()
 {
     base.OnPause();
     wakeLock.Release();
 }
        public override void OnDestroy()
        {
            m_WakeLock.Release();

            base.OnDestroy();
        }
Exemple #14
0
 /// <summary>
 /// on destroy function - handles destroy
 /// </summary>
 protected override void OnDestroy()
 {
     base.OnDestroy();
     wakeLock.Release();
 }