Problem about construct UnityPlayer with applicationContext on Android

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 ?

1 Like

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.

1 Like

It means there must be an activity between Android and unity?
6741043--776845--upload_2021-1-19_19-3-0.png