-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[core] raylib application not closing properly #3127
Comments
@Bigfoot71 Is this issue fixed? |
No, I was just coming back to the fact that using All things considered, it doesn't have a significant negative impact currently. It's simply advised against because the Android system should handle the entire closing process of the application itself, which it doesn't do currently for a reason that I'm unaware of. |
It is strange that I didn't notice the issue. I call the |
sorry if my message was not clear enough, this behavior happens if you reopen the application without using we just shouldn't have to use |
See https://stackoverflow.com/questions/2425167/use-of-exit-function |
@orcmid I have to say that it's an old answer (over 13 years old). The issue with the There are multiple Stack Overflow answers advising against using I can direct you to the Android documentation that explains the lifecycle of an activity. |
To summarize my experience of using raylib on android:
But:
@Bigfoot71 , do you have anything to add to the list ? except maybe unimplemented functionality such as file writes. |
@makimy From the issues/improvements you comment:
About Activity state saving and restoring (after being destroyed), that's a complex topic. |
@raysan5 You're right, it is not that simple, therefore, for my apps, I've choosen to maintain states manually.
|
@makimy You can easily set the screen orientation from the Other than that, I don't have much else to add. |
@Bigfoot71 You're right, it works just fine and requires only changes in the It might look a bit confusing, @raysan5 mentioned the problem from here . The confusion was because I didn't realize that |
Thank you for the explanation. I was commenting about use of On the other hand, if Android does not clean up properly on a proper |
@Bigfoot71 Is this isue addressed? can it be closed? what is the current state? |
@raysan5 Still nothing new, but I will update the raymob repository in a few days, so I'll have some time to dedicate to it. I will investigate why the |
Problem solved in this PR: #3227 |
Issue description
An issue occurs when closing and reopening raylib on Android. In PR #3067, I added the use of
exit()
at the end ofandroid_main
to terminate the application. This doesn't pose a major problem in the context of using raylib with the official provided template or when no other background process is running. However, if we remove this use ofexit()
, the application appears to close correctly at first sight. We return to the Android home screen, and a log in logcat indicates that the application has indeed finished, but logcat doesn't show the end of the process, and Android Studio also indicates that the app is still running. If we decide to relaunch the application from Android (without manually closing it in the task manager norexit()
), the app reopens to a black screen, and we get the errorEGL_BAD_DISPLAY
twice in logcat.This shouldn't happen. After calling
ANativeActivity_finish
and allowing the event loop to run during the closure, the application should close completely without having to call other C functions or Java methods.Therefore, we need to inspect the code more deeply to understand what is preventing this complete closure on Android. It could be a native background process, improper deallocation preventing the system from closing the app, or something else...
Note that another solution, which is slightly more correct, can be implemented to stop the application without going through Java. This would involve calling
exit()
inAndroidCommandCallback
within theAPP_CMD_DESTROY
case, which is called last, even after theonDestroy
method in Java. This doesn't make a big difference in basic usage of raylib, as I mentioned at the beginning, but it's good to know.The text was updated successfully, but these errors were encountered: