We discovered that if we construct UnityPlayer using Application instead of Activity, the program will crash because the libunity.so trying to call Activity.GetWindowManager on the application context .
We need to construct UnityPlayer with application context because 2 reasons:
1.we are trying to show the UnityPlayer across multi activities with a SurfaceTexture, it should not dependent of specify activity.
2.UnityPlayer.nativeRender() is trying to modify the fullscreen settings of the activity which passed into.
So,what is the right way to construct UnityPlayer instance avoid using a specify activity ?
Unfortunately Unity player requires activity context and there are no plans to change it. There was even a recent change to specifically require an Activity instead of a Context in the UnityPlayer constructor.