Beispiel #1
0
        bool RegisterScreenshot(Intent MediaProjectionToken)
        {
            IScreenshotService sshotService;

            try
            {
                if (MediaProjectionToken != null)
                {
                    var mediaProjection = MediaProjectionManager.GetMediaProjection((int) Result.Ok, MediaProjectionToken);
                    sshotService = new MediaProjectionScreenshotService(mediaProjection, _metrics);
                }
                else
                {
                    sshotService = new RootScreenshotService(GetSuperUser());
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
                return false;
            }

            _sshotService = sshotService;
            ScreenshotManager.Register(_sshotService);
            return true;
        }