Start a new topic

Android Backbutton behavior

Android Backbutton behavior


Good morning everyone!

I've noticed a strange behavior using back button on Android phones using Wikitude as Phonegap plugin. Here's how I reproduce the problem:


Download and install the "HelloImageRecognition" example from github ( https://github.com/Wikitude/wikitude-phonegap/tree/master/Android/Samples/extended/HelloImageRecognition )

Upload APK to smartphone and launch application

Press "Launch AR" button once then test image recognition with a wikitude logo

Press backbutton and make sure to return to Phonegap screen.


Until now, this is a correct behavior. Now let's make some action:


Launch again the application as described in step 3 above

Onche the ARView is loaded, and before hit the back button, tap on the screen like you want to click on a AR Drawable

Now press backbutton


In my case, this time the ARView not only closes itself, but also the phonegap application going into "Pause" state.

Therefore, after the app goes to pause, if I launch the app again and repeat the steps, the ARView is showed (I can see the wikitude logo in the corner) but the screen is completely black.

I have a Samsung S2 (Android 4.04.) and an Alcatel 997D (Android 4.0.4) and both give me same results. Anyone else noticed this problem?

Hi, I'm having the same issue.

I'm using phonegap 2.5 and if I touch the screen in the AR view the backbutton pause the app and I back in I only have a black screen.

I tried to override the backbutton like this 

document.addEventListener("backbutton", onBackKey, false);

function onBackKey()

{

     console.log('back');

     navigator.screenOrientation.set('portrait');

     WikitudePlugin.onBackButton();

     document.removeEventListener("backbutton", onBackKey, false);

}

 

But when I click on the backbutton it still quit and it doesn't go in my onBackKey function.

 

Do you have any idea how fix this?

No response? Does someone has read my issue?

Hi Jonathan,

Please check out latest PhoneGap Sample Appliction and PhoneGap Plugin.

The backbutton event is now for technical reason handled directly by the architectView, a backbutton press in the AR-View will alway cause user to go bach to previous PhoneGap screen.

FYI: When launching AR-View it in facts sits on top of PhoneGap context, retrieving its own location information and javascript calls. Once user pressed back it is removed from layout and gives control back to the PhoneGap environment.
 

Kind regards,
Andreas

Hi there!

Sorry for late response.

Which PhoneGap Version are you using? Maybe latest update causes this issue.
Do you have time to have a closer look on this issue and check if architectView's onPause is called the way it should and maybe even apply a github-pull-request.
The source code provided might be outdated,  any contribution is very appreciated.

Kind regards,
Andreas
Login or Signup to post a comment