anonfaded / FadCam

Seamless background video recorder for Android – ad-free and open-source, with customizable options.
GNU General Public License v3.0
289 stars 21 forks source link

[BUG] App is getting closed after some time #43

Open Chip3211 opened 1 week ago

Chip3211 commented 1 week ago

Bug Report

Description

Already mentioned in #40.

The app is closed (or crashes) by the system after 20-40 minutes and the video is still a temp file and will not be post processed.

When the app is closed, the recording notification still exists, but the camera indicator isn't showing.

Environment

Priority

anonfaded commented 1 week ago

Normally a persistent notification should fix this issue, but still it's there so we will need to tweak more. The Android version 12 and above has so many restrictions which is making it harder to fix.

@s0llvan

s0llvan commented 1 week ago

I'm trying to reproduce the issue, but I can't manage to. I'm able to record in both the foreground and background for 40 minutes without crashing (with same OS and app version).

Have you disabled battery optimization for this app ?

anonfaded commented 1 week ago

I'm trying to reproduce the issue, but I can't manage to. I'm able to record in both the foreground and background for 40 minutes without crashing (with same OS and app version).

Have you disabled battery optimization for this app ?

Btw i think we should tweak the app to ask for app overlay over other apps permission and to disable battery optimization option too. As i don't think there will be any other solution 🤔

Chip3211 commented 1 week ago

I uninstalled and reinstalled the newest build and it closed again after ~30 minutes. And I disabled all battery saving features.

anonfaded commented 1 week ago

I uninstalled and reinstalled the newest build and it closed again after ~30 minutes. And I disabled all battery saving features.

We will try to fix this. But the app crashes when u have turned off the screen? or you remove the app from recent apps too? If there is option in recent apps to lock the window of FadCam then lock it so it will always be there. Also try recording while the app is open to see if then it stops. And the persistent notification is there permanent or are you able to remove it by swiping? Normally it should be permanent there until recording is stopped.

Chip3211 commented 1 week ago

I start the recording, wait till the notification appears and lock the screen, without exiting or closing the app via the app switcher. As far as I know you can't lock apps on a pixel but I'll try leaving the screen on and try to record a longer video.

And all persistent notifications are dismissable on Android 14.

anonfaded commented 1 week ago

I start the recording, wait till the notification appears and lock the screen, without exiting or closing the app via the app switcher. As far as I know you can't lock apps on a pixel but I'll try leaving the screen on and try to record a longer video.

And all persistent notifications are dismissable on Android 14.

Okay then share with us. If it works fine on-screen then the issue for sure is with the android 14 and the restrictions from the manufacturer/google.

Will try to fix it, until then you can join the discord too if you like, so we can test it faster after any fix.

Also i would suggest to try another app too like XSCamera or any other just for testing to see if it behaves same or not during recording.

Chip3211 commented 1 week ago

I successfully recorded 60+ minutes with the app open. When the app is in the background and the phone is idling on the Home Screen, it’s getting closed again after ~30 minutes

muhammadkarodia commented 1 week ago

Check whether there is a toggle in Settings-> Developer Options -> Disable child process restrictions

I guess that should help

I think that toggle was added in Android 13

anonfaded commented 1 week ago

I successfully recorded 60+ minutes with the app open. When the app is in the background and the phone is idling on the Home Screen, it’s getting closed again after ~30 minutes

I'm adding wake lock and disable battery optimization features, will let you know when its done, it will hopefully fix the issue. Wake Lock will keep the cpu running offscreen so it should work hopefully.

Chip3211 commented 1 week ago

I start the recording, wait till the notification appears and lock the screen, without exiting or closing the app via the app switcher. As far as I know you can't lock apps on a pixel but I'll try leaving the screen on and try to record a longer video. And all persistent notifications are dismissable on Android 14.

Okay then share with us. If it works fine on-screen then the issue for sure is with the android 14 and the restrictions from the manufacturer/google.

Will try to fix it, until then you can join the discord too if you like, so we can test it faster after any fix.

Also i would suggest to try another app too like XSCamera or any other just for testing to see if it behaves same or not during recording.

XSCamera worked for the last hour

git-kup commented 1 week ago

Bug Report

Description

Already mentioned in #40.

The app is closed (or crashes) by the system after 20-40 minutes and the video is still a temp file and will not be post processed.

When the app is closed, the recording notification still exists, but the camera indicator isn't showing.

Environment

  • Device: Pixel 7a
  • OS: Android 14
  • App Version: 1.2.0 (beta)

Priority

  • [ ] Low
  • [x] Medium
  • [ ] High

i have the same problem. My device is the Unihertz Jelly Star running android 13 i followed instructions here https://dontkillmyapp.com/unihertz but keeps happening. it usually happens when i turn the screen on and off during a record session

app version: 1.1.3

anonfaded commented 1 week ago

i have the same problem. My device is the Unihertz Jelly Star running android 13 i followed instructions here https://dontkillmyapp.com/unihertz but keeps happening. it usually happens when i turn the screen on and off during a record session

app version: 1.1.3

New version will be released in some minutes, which will hopefully fix this issue. I will tag you both once i add the apk to releases :)

anonfaded commented 1 week ago

@Chip3211 @git-kup @s0llvan A new version is out with two fixes: a wake lock has been added to prevent the CPU from sleeping, and an option to disable battery optimization has been included. Please check the latest version and share your feedback here if your issue is resolved:

https://github.com/anonfaded/FadCam/releases/tag/v1.2.0-beta

anonfaded commented 1 week ago

btw just saw that FadCam is featured once again on HowToMen YT channel :) https://youtu.be/3pOoU5JjfnE?si=JMwoHfGyocXuvkC7&t=520

Chip3211 commented 1 week ago

It asked for permission to keep itself active but after ~30 minutes the same old behavior occurred

s0llvan commented 1 week ago

I'm also trying to find a solution

anonfaded commented 1 week ago

It asked for permission to keep itself active but after ~30 minutes the same old behavior occurred

Still if this is happening then the issue is with the android version and this is why i hate the latest versions lol But lets see if we can tweak it more. We have already done so much but still no progress.

Also can you try other off screen apps and let me know how they perform? You mentioned about XSCamera so it was working fine ?

Chip3211 commented 1 week ago

It asked for permission to keep itself active but after ~30 minutes the same old behavior occurred

Still if this is happening then the issue is with the android version and this is why i hate the latest versions lol But lets see if we can tweak it more. We have already done so much but still no progress.

Also can you try other off screen apps and let me know how they perform? You mentioned about XSCamera so it was working fine ?

Yea, i started a test this morning and stopped it after 4 hours without a problem.

anonfaded commented 1 week ago

I'm also trying to find a solution

Hey i just got an idea which will very likely fix this issue! We can give more load on cpu which very likely will keep the app in higher priority and won't kill it.

So the idea is to add the display over other apps permission and during recording we use a part of screen to show a black square ⬛. Like it will be permanently there no matter if we leave the app or off the screen. When we check it thoroughly and It works out then after that we can tweak it to make it transparent so it becomes invisible so we see nothing on screen but it will be there so it will enforce CPU to not sleep.

I feel this is the very practical approach as we have nothing else to do. Let me know what do you think...

anonfaded commented 1 week ago

Yea, i started a test this morning and stopped it after 4 hours without a problem.

Okay, thanks. I feel the new idea that i shared will work fine, will let you know when i or @s0llvan do it.

s0llvan commented 1 week ago

I'm also trying to find a solution

Hey i just got an idea which will very likely fix this issue! We can give more load on cpu which very likely will keep the app in higher priority and won't kill it.

So the idea is to add the display over other apps permission and during recording we use a part of screen to show a black square ⬛. Like it will be permanently there no matter if we leave the app or off the screen. When we check it thoroughly and It works out then after that we can tweak it to make it transparent so it becomes invisible so we see nothing on screen but it will be there so it will enforce CPU to not sleep.

I feel this is the very practical approach as we have nothing else to do. Let me know what do you think...

I'm quite skeptical about this solution 😬, it could cause issues when using Google Maps, for example, or other applications that also use overlays (especially during trips) 😶

anonfaded commented 1 week ago

I'm quite skeptical about this solution 😬, it could cause issues when using Google Maps, for example, or other applications that also use overlays (especially during trips) 😶

But if we just test by placing a square somewhere, and if it solves the issue then maybe we can make that a very small pixel and top or at the end of screen so it won't mix with any gestures? I don't think so we can do anything else? As the persistent notification also failed. Or maybe if we reverse engineer some other offscreen recorder to see how it works😅 I'll try to do this...

s0llvan commented 1 week ago

Good news, I think I've managed to find the solution. I moved the video capture into the service and linked this service to the notification. I completely exited the app, and a button on the notification allows me to stop the recording. There are still bugs to resolve, such as the notification being removable by the user while the recording continues. I also need to handle returning to the app while a recording is ongoing. All of this will take some time, but I think we're on the right way ! 😁

Chip3211 commented 1 week ago

Sounds good.

There are still bugs to resolve, such as the notification being removable by the user while the recording continues.

As far as I understood the Android 14 behavior, the user is able to remove a “persistent” notification but even if dismissed the functionality should not change

anonfaded commented 1 week ago

Good news, I think I've managed to find the solution. I moved the video capture into the service and linked this service to the notification. I completely exited the app, and a button on the notification allows me to stop the recording. There are still bugs to resolve, such as the notification being removable by the user while the recording continues. I also need to handle returning to the app while a recording is ongoing. All of this will take some time, but I think we're on the right way ! 😁

Nice, keep trying so I'll leave this on you now :)