Firstly as you haven't extended anything onCreate() is not available to you as a lifecycle method within the Android framework.
Perhaps it may be best to extend Activity or more likely Service dependent on your needs and override onCreate() and add your appropriate code constructs and then call it with your game data bundled up and passed via an Intent.
Additionally doing any computational work on the main/UI thread will likely result in a lot of Jank (dropped frames) so I would IntentService/AsyncTask/Runnable or whatever the heavy lifting.
Something basic to handle the sensor like:
Activity.class
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
....
Intent i = new Intent(this, GameEngineSensor.class);
/* parcel up your game data here */
startService(i);
GameEngine.class
public class GameEngineSensor extends Service implements SensorEventListener{
public GameEngineSensor() {
}
@Override
public void onCreate() {
super.onCreate();
/*unparcel game data here */
SensorManager gameEngine = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
//registerListener as appropriate..
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
//....
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
//....
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
If you have more core logic I'd run it within a service, whether an IntentService or Service with AsyncTask, Runnable or whatever as a minimum.
You can callback the UI to handle the sensor changes from within the SensorEventListener Callbacks using various methods, bound service (Messenger/IBinder), Broadcast (likely slow), or via the UI Looper and a handler.