In my android app, I’m calling the Unity + Vuforia (qualcomm) side which opens the camera view and play a game. Then it goes back to the android side. In the android app when I exit the application(closing all the activities with finish()) it goes back to the unity + camera view. I close all the activities with finish() correctly. Not sure what I need to close/destroy the unity/vuforia instance.
When coming back to the android side from the unity if I call Application.Quit() it closes the whole app…not just the unity part…
Is there any method to close/destroy just the unity instance either within the unity side or from the android side.?
I fixed the unity instance closing issue like this
I fixed this like this
Extended the QCARPlayerActivity (earlier I had QCARPlayerProxyActivity )
Called super.onDestroy(); in the public void onPause() method of the activity which extends the QCARPlayerActivity … called onDestroy within some if condition…
Also set android:noHistory=“true” for QCARPlayerProxyActivity, QCARPlayerNativeActivity in application manifest file and QCARPlayerActivity, QCARPlayerProxyActivity, QCARPlayerNativeActivity in unity library manifest file. (Dont’ know whether this is necessry or not)
It works but not sure whether that’s a proper way to do it.
Later when testing, realized that calling super.onDestroy(); closes my app completely in some phones.
So finally found a better solution.
In the activity which extends the Unity activity (or QCARPlayerActivity/QCARPlayerProxyActivity ), when calling the next activity called it like startActivityForResult(Intent, int) instead of startActivity and added another method in that class onActivityResult(int, int, Intent). And called finish() inside this method.
Now it seems to work fine and properly close the Unity instance.
I had a problem closing the unity activity. In fact when I click back button in the activity that extends QCARPlayerActivity my application quits instead of returning to previous activity. Your solution (calling super.onDestroy in the onPause function) solved my problem but now I have another one :
When I click back button a blank screen appears before the previous activity. Do you have any idea? how can I remove this screen?