We have a strange bug on our last game and we would like to know if someone have a solution ^^.
So we have 2 apk able to switch from one to another with this in Unity :
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject pm = jo.Call<AndroidJavaObject>("getPackageManager");
AndroidJavaObject intent = pm.Call<AndroidJavaObject>("getLaunchIntentForPackage", "BundleIdentifier");
catch (Exception e)
Debug.Log ("error : " + e.Message);
With this, if there is no exception, the other app with bundle identifier equal to "BundleIdentifier" is open. Else, we go to the store to DL it.
The problem is that if one of the application change its main activity in its manifest, it can't be reopen. For example, open A, switch to B(open because never opened yet) and switch back to A. Here, when switch back to A, A is frozen on a black screen and after 1 min, the app is killed for inactivity.
Here is an example of a manifest with main activity changed to use Vuforia :
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
We have same problem with chart boost for example because it's also change the main activity.
The strange thing is that if you have apk A with a custom main activity like this and B normal :
WORK : open B, B switch to A (A is opened for the first time), A switch to B, B switch to A, A switch to B...
DO NOT WORK : open A, A switch to B (B is opened for the first time), B switch to A, BLACK SCREEN.
It's easy to reproduce so if someone could help use please ^^.