Android Question How do I make a service run at the moment I want while I run another application in the foreground?

carlos7000

Well-Known Member
Licensed User
Longtime User
I'm trying to make an application that remains running in the background, ready to take a screenshot. But I don't know how to make it take the screenshot at the moment I need it. On my Motorola, I just have to put 3 fingers on the screen to take a screenshot, but I can't do that on my tv box. I've tried a couple of applications from Google Play, but they didn't work, so I thought, if it wasn't too difficult, I could create my own screenshot application. I already got the code from another post, which works. But I don't know how, being in an application that runs in the foreground, to make the one that takes the screenshot run at the moment I want it to.
 

carlos7000

Well-Known Member
Licensed User
Longtime User
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
Hi Erel. Thank you very much for your response. Although I'm not an expert, thanks to your responses, I'm already using 'services' in some of my applications. I found a code on the forum that may be useful for me to make a screenshot (https://www.b4x.com/android/forum/threads/b4a-ah_takescreenshot-take-a-screenshot-library.130872/). I put the code in a service, thinking that maybe it's the correct way to take a screenshot.

But to test the code, I need some way to tell the program to take the capture. I want to run the program on a TV box to capture phone numbers, addresses and other data. The TV box does not have physical buttons. I have tried several Google capture programs, but they require pressing the volume or holding 3 fingers on the screen. Please help me.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
But to test the code, I need some way to tell the program to take the capture. I want to run the program on a TV box to capture phone numbers, addresses and other data. The TV box does not have physical buttons. I have tried several Google capture programs, but they require pressing the volume or holding 3 fingers on the screen. Please help me.
Do you have TV box remote? if yes you can use it to take the capture.
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
When trying to compile the program, this message appears to me.

B4A Version: 12.00 Parsing code. (0.01s) Java Version: 11 Building folders structure. (0.01s) Running custom action. Error​

ROBOCOPY :: Efficient File Copy Tool​

Start: Sunday, January 1, 2023 12:34:42 AM Source : C:\Users\Carlos\Desktop\SCREEN1\B4XPAG1\Shared Files
Destination : C:\Users\Carlos\Desktop\SCREEN1\B4XPAG1\B4A\Files
Files: .

Options: . /DCOPY:DA /COPY:DAT /R:1000000 /W:30​

2023/01/01 00:34:42 ERROR 2 (0x00000002) Getting File System Type of Source C:\Users\Carlos\Desktop\SCREEN1\B4XPAG1\Shared Files
The system cannot find the file specified.
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
Upon reviewing the code for the application, I see that it only captures video.

Sin título.png
 
Upvote 0

teddybear

Well-Known Member
Licensed User
When trying to compile the program, this message appears to me.
It has told you that cannot find the file specified. you need create Shared Files folder or delete line #CustomBuildAction in B4xMainPage module.
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
It has told you that cannot find the file specified. you need create Shared Files folder or delete line #CustomBuildAction in B4xMainPage module.

Comment on the line that you mentioned to me. I compile it and it works correctly. Thank you very much.
 
Upvote 0
Top