Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get screenshot in background activity #9

Open
sheng-di opened this issue Mar 15, 2020 · 6 comments
Open

Cannot get screenshot in background activity #9

sheng-di opened this issue Mar 15, 2020 · 6 comments
Labels
question Further information is requested

Comments

@sheng-di
Copy link

screenshotManager = new ScreenshotManagerBuilder(getActivity())
        .withPermissionRequestCode(REQUEST_SCREENSHOT_PERMISSION)
        .build();
ScreenshotResult screenshotResult = screenshotManager.makeScreenshot();
// following code seems no usage
screenshotResult.observe((screenshot) -> {
    // WON'T GET THE SCREENSHOT 
    return Unit.INSTANCE;
}, (throwable -> {
    return Unit.INSTANCE;
}));

If the activity is in foreground, it performs well. However, when broadcasting the activity, and put this code in receiver's callback, I cannot get the screenshot.

@sheng-di
Copy link
Author

How can I use MediaProjection explicitly?

@abossjamlai
Copy link

can you guide me, I don't know Kotlin exactly so I don't know exactly how you get a screenshot object from "it"?
please help me

@sheng-di
Copy link
Author

sheng-di commented Apr 2, 2020

can you guide me, I don't know Kotlin exactly so I don't know exactly how you get a screenshot object from "it"?
please help me

Apologize for the late reply.
I post my code here:
Screen Paste

I am just an android beginner, and inadvertently found that screenshotResult.observe method can obtain an screenshot object, which can be cast to ScreenshotBitmap, and the ScreenshotBitmap object has the getBitmap method.

Currently, I want to get the screenshot after clicking a notification. However, it doesn't work.
Would you clone and check it for me?Any help will be appreciated. Thanks.

It's an interesting application which can float texts or pictures on the screen. �I wanted to increase the productivity of my phone, but I didn't find a similar application, so I studied Android and made a simple version. Hope you can answer my confusion.

@xzaleksey
Copy link
Contributor

can you guide me, I don't know Kotlin exactly so I don't know exactly how you get a screenshot object from "it"?
please help me

Apologize for the late reply.
I post my code here:
Screen Paste

I am just an android beginner, and inadvertently found that screenshotResult.observe method can obtain an screenshot object, which can be cast to ScreenshotBitmap, and the ScreenshotBitmap object has the getBitmap method.

Currently, I want to get the screenshot after clicking a notification. However, it doesn't work.
Would you clone and check it for me?Any help will be appreciated. Thanks.

It's an interesting application which can float texts or pictures on the screen. �I wanted to increase the productivity of my phone, but I didn't find a similar application, so I studied Android and made a simple version. Hope you can answer my confusion.

Hi!
Did I get you correct that the issue is that you don't get broadcast during clicking to notification? But not that screenshotty doesn't make a screenshot?

@xzaleksey xzaleksey added the question Further information is requested label Apr 28, 2020
@sheng-di
Copy link
Author

can you guide me, I don't know Kotlin exactly so I don't know exactly how you get a screenshot object from "it"?
please help me

Apologize for the late reply.
I post my code here:
Screen Paste
I am just an android beginner, and inadvertently found that screenshotResult.observe method can obtain an screenshot object, which can be cast to ScreenshotBitmap, and the ScreenshotBitmap object has the getBitmap method.
Currently, I want to get the screenshot after clicking a notification. However, it doesn't work.
Would you clone and check it for me?Any help will be appreciated. Thanks.
It's an interesting application which can float texts or pictures on the screen. �I wanted to increase the productivity of my phone, but I didn't find a similar application, so I studied Android and made a simple version. Hope you can answer my confusion.

Hi!
Did I get you correct that the issue is that you don't get broadcast during clicking to notification? But not that screenshotty doesn't make a screenshot?

It seems to be so.
If the application runs in background, it fails

@albert17
Copy link

Is this supported now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants