Log in or register to post comments

Back button forces the application exit

February 14, 2013 - 10:28am #1

Hi. I know that this isn't a new problem. I've read and tried all the solutions to it, but without effect: When you press back button from Vuforia Activity, or call finish(), the application exits. If I called the application by a startActivity (or startActivityForResult) from another activity, the app never returns to it.

I'm not using Unity. Also, I've tried the "noHistory" solution, different combinations of startActivity, startActivityForResult, etc, without results.

The app ever quits, and the execution never arrives to onActivityResult of the main activity (this is a very simple activity, with just one button).

I believe that there is any "application.quit" in QCAR library, but I'm not sure. If this is the case, there are any way to override this? Otherwise, any other solution?

I need to integrate Vuforia within an existing app.

Thanks in advance.

Back button forces the application exit

February 15, 2013 - 4:56am #7

Glad to hear it has been solved!

 

Back button forces the application exit

February 15, 2013 - 4:53am #6

Hi. The problem has been solved! It was my fault, obviously.

There was an android:noHistory="true" on my manifest for the main activity. I copied the ImageTarget example to make it changes and to create my application. I deleted the second activity (not the main, the splash screen), and I forgotten to check this parameter.

Well, 48 hours bug. 

Sorry for that, and thanks for your assistance. At least, now I undertand better the vuforia system (and it's great )

Back button forces the application exit

February 15, 2013 - 3:59am #5

Hi again. Thanks for your answer.

Now I'm testing it with only one target, without changes in my problem.

I've checked when the main activity is killed. Sometimes it happens when Vuforia activity is loading, but before the target is loaded (as log messages show me). The other times happens when back button is pressed, and before Vuforia activity runs its onDestroy (it's difficult to be precise using the debugger breakpoints or log messages).

I accept that this is a bug for my I9000. But I don't uderstant why the examples run without problems, but my code not. I removed any "finish" call, so I cannot see what, where, how and when a kill signal is seny to my main actiivity.  

Back button forces the application exit

February 14, 2013 - 10:59pm #4

Hi, 

Later, when vuforia activity ends, the system cannot recover the previous activity. Is this a possible explanation?

Yes, this is a possible explanation; actually the Android system might have reomved your "previous" activity due to memory constraints; normally, however, Android also keeps track of all the activity that were killed for memory / resource reasons, and restores them (recreating them) when exiting from the top activity (the Vuforia one in your case);

so, from a theoretical point of view, you should be able to get back to your "previous" activity (after leaving the Vuforia one), but this will probably entail the recreation of the "previous" activity which was killed by Android; therefore this process may not be instantaneous; have you tried waiting a few seconds to see if your activity shows up after some time ?

If not, then it could be an issue at the Android level (e.g. a "bug" or misbehaviour of Android on the Samsung device);

the only thing you could do to verify this is to try your App with a reduced number of targets, until you see that the behaviour gets back to normal...

 

Back button forces the application exit

February 14, 2013 - 4:40pm #3

I really know that by default, closing an activity (or pressing back button), the Android system recovers the previous activity. But this is not my case.

I've read in other forums that my Samsung I9000 could be the problem, but I'm not sure about this information.

I've tried the examples, and they run right (when back button is pressed, it returns to the main activity).

Watching the code, and checking that both (example and mine) are practically equal, I've a theory. I would appreciate if anyone can verify it. From ImageTargets example, I've developed a very similar adaptation, but with other targets and geometry. I load several targets when application starts. Watching the logcat, it uses  a lot of memory to load the targets. This could kick off the main activity from memory. Later, when vuforia activity ends, the system cannot recover the previous activity. Is this a possible explanation?

Back button forces the application exit

February 14, 2013 - 11:03am #2

Hi, you don't need to call the finish() function or do anything special in order to exit the Vuforia activity and get back to the "previous" activity;

just pressing the back button on your device will make Android exit the activity and will automatically go back to the previous activity in the activity stack;

Please have a look at our ImageTargets sample, you will see that there are several activities chained one on top of the other, and the last (top-most) activity is the Vuforia one; just check the code there, make sure to implement onPause()/onResume() and onDestroy() correctly;   you will see that there is no special handling in ImageTargets.java to make the activity exit.  It's just done automatically.

 

Log in or register to post comments