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

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

Closed
1 of 3 tasks
Chip3211 opened this issue Sep 23, 2024 · 26 comments
Closed
1 of 3 tasks

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

Chip3211 opened this issue Sep 23, 2024 · 26 comments
Labels
bug Something isn't working

Comments

@Chip3211
Copy link

Chip3211 commented Sep 23, 2024

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
  • Medium
  • High
@anonfaded
Copy link
Owner

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
Copy link
Contributor

s0llvan commented Sep 23, 2024

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
Copy link
Owner

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
Copy link
Author

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

@anonfaded
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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

@anonfaded anonfaded added the bug Something isn't working label Sep 23, 2024
@muhammadkarodia
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link

git-kup commented Sep 23, 2024

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
  • 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
Copy link
Owner

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
Copy link
Owner

@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
Copy link
Owner

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

@Chip3211
Copy link
Author

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

@s0llvan
Copy link
Contributor

s0llvan commented Sep 24, 2024

I'm also trying to find a solution

@anonfaded
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Contributor

s0llvan commented Sep 24, 2024

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
Copy link
Owner

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
Copy link
Contributor

s0llvan commented Sep 24, 2024

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
Copy link
Author

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
Copy link
Owner

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants