Log in or register to post comments

Start / End QCARPlayer from within Android

October 10, 2013 - 6:32am #1

Hi,

I used this tutorial https://developer.vuforia.com/forum/faq/unity-how-can-i-extend-unitys-android-activity to start the QCarPlayer within my Android App. I search the View where the Player is in recursively and this works just fine. When I want to return, I call mQCARView.setVisibility(View.GONE); on my QCAR view which is (as far as I understood) hiding the Unity Player. But the thing is, when I call it, it doesn't only hide the player but also seems to finish my other Activity. So the setup here is as follows

Activity A -> Activity B -> QCAR Player

So far this works fine. But when I now want to hide the player and would expect to come back to Activity B, I turn out to be at Activity A. Any idea why this could happen? Am I missing something?

 

Thank you so much!

 

Start / End QCARPlayer from within Android

October 18, 2013 - 5:39pm #10

Hi,

turns out that is not a Vuforia specific problem. It was rather because I hade some things wrong with the context. 

But I have another question for you: When I use the mentioned code, I am not able to start my AR View twice. The second time it doesn't start well. I have an idea why and this leads to my question: How can I totally destroy the UnityPlayer there? (So that I can start it again by calling the activity as in the normal process). Couldn't figure out how to do this, onDestroy() and finish() don't do the magic. I think I have to destroy the view but how can I do that?

Thanks!

- S

Start / End QCARPlayer from within Android

October 17, 2013 - 12:21am #9

Thanks for the details on the fragments, but I cannot see any obvious reason why it should behave in that way;

I wonder if UnityPlayerActivity itself (the regular Unity version, not the QCAR one) may have some issues with such fragment-based configuration; one thing you may want to try is to *take Vuforia out of the equation*, and trying doing the same Activity flow  without Vuforia,  i.e. just using an empty Unity scene;

this could tell us if there is something specific to Vuforia or to the UnityPlayer when using Android fragments. 

Start / End QCARPlayer from within Android

October 16, 2013 - 2:36pm #8

Any news on this topic?

Start / End QCARPlayer from within Android

October 10, 2013 - 11:50am #7

Activity A: 6 equal fragments, addressed through a Navigation Drawer one of those Fragments contains a list, onItemClick you start Activity B

Activity B: n equal fragments which can be exchanged through swiping left/right. All same layout, different content. In there I have an Action Item in the Action Bar which creates an intent and starts ARActivity. 

ARActivity: Code from the mentioned source + some static methods called from Unity

 

I hope this is what you wanted to know, please let me know if I need to clarify anything!

Start / End QCARPlayer from within Android

October 10, 2013 - 11:27am #6

Can you explain briefly what is the structure and view hierarchy of your Fragment-based activity ? and what do you do when you start the Unity-QCAR from Activity B ?

 

Start / End QCARPlayer from within Android

October 10, 2013 - 10:49am #5

I tried what you suggested and with this time it worked perfectly with the same code. Any idea what the Problem with the Fragments could be? I am really stuck here :/

Start / End QCARPlayer from within Android

October 10, 2013 - 8:09am #4

Not sure if the Fragments play a role here, but I cannot exclude it;

one thing you could try to reproduce the issue on a build a basic sample (again using the same approach explained in the article you refer below, but with a simplified UI, without Fragments and Page Adapater).

Start / End QCARPlayer from within Android

October 10, 2013 - 7:06am #3

I just tried it and got the same result. Maybe it helps to mention that my AR View is startet from an activity which consist of several Fragments. I used a Pager Adapter for it, as I needed swipable views. Any idea?

Start / End QCARPlayer from within Android

October 10, 2013 - 6:50am #2

Have you tried with:

mQCARView.setVisibility(View.INVISIBLE);

instead of GONE, to see if it makes any difference ?

Log in or register to post comments