Start a new topic

Handle back-button directly within ARWorld ?

Handle back-button directly within ARWorld ?


I read several threads about the handling of the back-button in wikitude app and I am quite confused.

If I understand correctly, if an AR World is launched within the app, then the back-button will exit it (??).

Is there a way to prevent this behavior ?

Would that be possible to handle the back-button event directly in the AR World ?

If that is not possible, is there a way to just disable the back-button when the AR World is launched ?

Thanks :-)

Update : this topic has been initially posted in the wrong category and has been moved to the right one.

Hi Amaury,
I assume you are talking about our Cordova plugin? If so, you're right. You can't change the behaviour without modifying our plugin Java code (which you can do of course. line 706 to 728.). When opening our plugin view, we connect the back button with the functionality of closing our plugin view. There is a callback that you can set for Android to do some custom behaviour once this is happening (In your Cordova app). This event you can then also forward into your Architect World, but it will be closed anyhow immediately after.

Best regards,

Thanks Andreas. 

I finally found a solution to :
- to prevent from leaving the AR World when the android back button is pressed,
- and handle directly the event within the AR World.

How is that possible ?
1. So I first modified the file and commented these part (around line ~717) :

// if (architectView!=null && keyCode == KeyEvent.KEYCODE_BACK) {
// if (WikitudePlugin.this.locationProvider != null) {
// WikitudePlugin.this.locationProvider.onPause();
// }
// removeArchitectView();

This way the ARWorld is not closed when the backbutton is pressed. 

2. Then in main index.js file of my cordova app I declared the following onBackButton function (like on the official sample code here )  :
    onBackButton: function() {

3. Finally in my ARworld main javascript file, I have the following function:
function onBackButton() {
  console.log("the backbutton has been pressed, and I am still in augmented reality !");

Hi Amaury,
Thx for sharing your solution.

I'm not sure if you still have an open question or not?

Best regards,


you're my hero #Amaury  tkanksssss

Thanks but i not comment

 if (architectView!=null && keyCode == KeyEvent.KEYCODE_BACK) {

but push Volumen +/- error

Login or Signup to post a comment