| | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.content.res.Configuration; |
| | | import android.graphics.PixelFormat; |
| | | import android.os.Bundle; |
| | | import android.os.Process; |
| | | import android.view.KeyEvent; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.view.Window; |
| | | |
| | | import android.view.WindowManager; |
| | | import android.os.Process; |
| | | import com.unity3d.player.IUnityPlayerLifecycleEvents; |
| | | import com.unity3d.player.UnityPlayer; |
| | | |
| | |
| | | getIntent().putExtra("unity", cmdLine); |
| | | |
| | | mUnityPlayer = new UnityPlayer(this, this); |
| | | // setContentView(mUnityPlayer); |
| | | // mUnityPlayer.requestFocus(); |
| | | setContentView(mUnityPlayer); |
| | | mUnityPlayer.requestFocus(); |
| | | } |
| | | |
| | | // When Unity player unloaded move task to background |
| | |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | // If the activity is in multi window mode or resizing the activity is allowed we will use |
| | | // onStart/onStop (the visibility callbacks) to determine when to pause/resume. |
| | | // Otherwise it will be done in onPause/onResume as Unity has done historically to preserve |
| | | // existing behavior. |
| | | @Override protected void onStop() |
| | | { |
| | | super.onStop(); |
| | | mUnityPlayer.pause(); |
| | | } |
| | | |
| | | @Override protected void onStart() |
| | | { |
| | | super.onStart(); |
| | | mUnityPlayer.resume(); |
| | | } |
| | | |
| | | // Pause Unity |
| | | @Override protected void onPause() |
| | | { |