More Gyroscope Implementation
Yesterday.. I was so locked into getting the Tilt Control Class done that I forgot to post!
I was put on the right path to implementing my compilation of libGDX into my existing live wallpaper project here: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=19710. Though, while I'm in initial develoment phase for the Live Wallpaper app, I figured I'd first build out the source, enabling the Gyroscope specifically on the Android side of libGDX. Some of libGDX's complexity comes from it's inherent cross platform ability. So, when you extend libGDX, you not only need to write code to implement for Android, you need to implement for iOS, and also figure out how that depricates on PC and OSX platforms as well. "Ain't nobody go time for dat!"
May Day! My pause() and dispose() methods are not being called on Android. I swear I've seen them called before, must have been on the PC side, not the android side. DOH! Looks like it's a known bug, that was close as "WontFix"!
Someone here is suggesting a hack for it. But, this is not good. http://stackoverflow.com/questions/21364254/libgdx-pause-and-dispose-met...
Here is the main bug thread I've found on this issue: https://code.google.com/p/libgdx/issues/detail?id=1348 ..... which explains that it's mostly the EGLSurface that is having a problem, presumably in OpenGL 2.0. I need pause and dispose for other reasons. I may go with the hack to get the hooks in and pause my listeners for the gyro sensor.... Unless, I can extend the engine like previously thought. I know the call to retrieve Accelerometer data occurs right before render() is called. If I could poll the gyro data at the same time, I'd be in good shape. I should have a look to see how libGDX is handling their sensor listening.... or if that data is polled on every frame.
Confirmed, libGDX implements the Accelerometer exactly as I have been implementing the Gyroscope. To get data from a sensor, you need a listener, where I was hoping I could maybe periodically poll the sensor data just before every frame was rendered. Though, I do see that the listeners are unregistered onPause(). So, that's what I'll have to do for now. Good to see I'm on the right track, and that later implementation into libGDX won't be too difficult. It's the iOS implementation that I'll probably just leave unfinished at the time I make a pull request. I have no use for iOS, so maybe I let someone else handle that code? I doubt the libGDX contributors would like that much.
I am soooo freaking stuck on this one. I can't get a hook into onPause() for the life of me. And, using my own compilation of libGDX won't take either. Once I get the libraries implemented, Android complains of missing classes.
06-19 17:02:40.428: D/AndroidRuntime(30408): Shutting down VM
06-19 17:02:40.428: E/AndroidRuntime(30408): FATAL EXCEPTION: main
06-19 17:02:40.428: E/AndroidRuntime(30408): Process: us.novak.UM3DLWP.android, PID: 30408
06-19 17:02:40.428: E/AndroidRuntime(30408): java.lang.RuntimeException: Unable to instantiate service us.novak.UM3DLWP.android.LiveWallpaper: java.lang.ClassNotFoundException: Didn't find class "us.novak.UM3DLWP.android.LiveWallpaper" on path: DexPathList
06-19 17:02:40.428: E/AndroidRuntime(30408): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3164)
06-19 17:02:40.428: E/AndroidRuntime(30408): at android.app.ActivityThread.access$1900(ActivityThread.java:179)
06-19 17:02:40.428: E/AndroidRuntime(30408): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
What I really don't get is that the aforementioned Class is the root class of my app! It shouldn't even have anything to do with the included jars.