- Home /
UnityPlayerActivity won't launch properly on Android APIs lower that API 21
Hello,
I have created two unity games which I export as an android project. This project is turned into an .aar library from Android Studio and included into another Android Application. The problem that I face, is that on Android APIs lower that API 21, the UnityPlayerActivity won't launch properly. The UnityPlayerActivity is launched as startActivityForResult(). Here is the code:
Intent intent = new Intent(this, UnityPlayerActivity.class);
startActivityForResult(intent, REQUEST_CODE_FOR_UNITY_PLAYER);
The result is the following:
if (requestCode == REQUEST_CODE_FOR_UNITY_PLAYER) {
if (resultCode == RESULT_OK) {
//do sth
} else {
// show ResultActivity.
}
}
The result code is never equal to RESULT_OK and the ResultActivity is shown. The crazy fact is that by pressing the back button on ResultActivity, the UnityActivity starts properly. The only evidence is that onPause() is called directly after onResume() on UnityPlayerActivity when it is created for the first time.
I would appreciate any kind of help. Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220612142255im_/https://answers.unity.com/themes/thub/images/avi.jpg)