B4A Library MediaProjectionScreenshot library

This is the B4A library i have ordered on our forum for my project: thanks, @somed3v3loper !
Possibility: making the screenshot of Android APi21+ system (or multiple screenshots) of the real device screen size (without black borders), it includes the virtual buttons block.

The source code is published also under LGPL license: please, upload any updated lib version and its source code to this forum, if you downloaded it and updated.
The library development was paid, so, if you would like - you may donate any amount to compensate those cost, if the lib is really useful in your project.
 

Attachments

  • MediaProjectionScreenShot_lib_v.2.0.zip
    5.8 KB · Views: 457
  • MediaProjectionScreenShot_source_v.2.0.zip
    2.1 KB · Views: 407
  • Test_B4A_project_0.14.zip
    10.1 KB · Views: 418
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
GNU GPL v.3
This is a problematic license. It means that this library could only be used in open source (GPL) projects.
If you want to share this library with other developers then it is better to use LGPL or a more permissive libraries (which all other developers use).
 

zhousongke

Member
Licensed User
Longtime User
Thanks, Erel, updated. The main task is to get the updated versions back for the community.


This is a useful library for getting global screenshots! Some suggestions are that, objects keep running in the service after initialization may cause the display of the screen to become sluggish, Might it be better to add 'PAUSE' function ?
 

zhousongke

Member
Licensed User
Longtime User
Sure, update, test and upload here your result lib, increment the subversion

After testing, I found that the mProjection object was created and kept running in the background, which may cause the screen display to become sluggish, regardless of the screen capture time interval, even if it is not in the process of screen capture. This can make eyes tired and dizzy. I modified the Java code to allow b4a to stop the mProjection object after one screen capture and create it again the next time. The performance of the screen display has been improved on my phone.
 

Attachments

  • MediaProjectionScreenShotLib.zip
    5.7 KB · Views: 397
  • MediaProjectionScreenShotLibSourceCode.zip
    1.7 KB · Views: 344
  • MediaProjectionScreenshotTest.zip
    11.1 KB · Views: 335

hears

Active Member
Licensed User
Longtime User
i use this library take screen picture every 500ms. and i didn't write image butter to disk,i just need pictures data.
app work about 2 minutes will be crash. and some time Android system will auto restart.

the modified library i have try too. have same problem.
if take pictures too many system will become slow ly. how to optimize ?
 
Last edited:

zhousongke

Member
Licensed User
Longtime User
i use this library take screen picture every 500ms. and i didn't write image butter to disk,i just need pictures data.
app work about 2 minutes will be crash. and some time Android system will auto restart.

the modified library i have try too. have same problem.
if take pictures too many system will become slow ly. how to optimize ?

I use this library take screen picture every 500ms for 6 minute, No crash occurred.

I am poor in Java. I learned Java in this way: 1. Download simplelibralcompiler; 2. Download other people's Java source code; 3. Insert debugging code into Java code; 4. Test in b4a after recompiling class library.

Debugging code looks like this:
ba.Log("JavaLog: Variable XXX'value = " + XXX);
When executing to this line of Java code, the result will be displayed in the "Log Window" of B4A.

In this way, I can understand the logic of Java source code and find errors. You can try.
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
I have the same problem with my Huawei P30 Pro.

i tested both examples out of the box.
My phone gets slower and slower with each screenshot until it completely freezes and reboots itself.
Setting Capturespeed to 1sec, it eats all of the 4GB of Free RAM within minutes
 
Top