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

Better Activity lifecycle event handling #4

Open
JeroMiya opened this issue Oct 12, 2015 · 0 comments
Open

Better Activity lifecycle event handling #4

JeroMiya opened this issue Oct 12, 2015 · 0 comments

Comments

@JeroMiya
Copy link
Contributor

We currently have event handlers for onCreate, onStart, onStop, onPause, and onResume for the MainActivity. The native code has init, step, and stop methods. init is called in MainActivityView.Renderer.onSurfaceChanged, and stop is called in onStop.

There are some issues with this. The native init method initializes the OpenGL state (good), but it also initializes the OSVR server and context (bad). OSVR should be initialized only once in onCreate, and shutdown only once in onDestroy, which we aren't handling at the moment. We should probably do something useful in onPause and onResume, or maybe onStart and onStop? As in, pause the server somehow?

If you look at the serverThread branch, you'll see an implementation using the server thread instead of joint client kit. Notice how the app crashes when you attempt to start the server a second time in the same process, even with a completely new instance of osvr::server::Server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant