Hi,
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 :
try
{
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");
jo.Call("startActivity", intent);
}
catch (Exception e)
{
Debug.Log ("error : " + e.Message);
Application.OpenURL("market://details?id= BundleIdentifier");
}
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 :
<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"
android:label="@string/app_name"
android:screenOrientation="sensor"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name"
android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"
android:value="false" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
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 ^^.
It sounds like you're saying that the <activity android:name=" "> value in the manifest gets changed by Vuforia once that app is opened and that you have code that is trying to reference the original name value. Is that correct?