Start a new topic

Crash on backbutton event in PhoneGap

Crash on backbutton event in PhoneGap


 

Hi,

this is my problem:

i have an image recognition world (in PhoneGap 2.4) and in my WikitudePlugin.js i have changed the close function in this way:

 

onBackButton : function() { 

if (WikitudePlugin.isOpened) {

if ( confirm('Exit AR?') ) {

WikitudePlugin.close();

document.removeEventListener("backbutton", WikitudePlugin.onBackButton, false);

}

}

},

it is simple and works perfectly but as soon as I do any operation in the World ( I have observed that is sufficient that i touch the screen ) the next time i press the back button the app crashes:

 

02-19 01:45:30.325: E/WindowManager(30813): Activity com.bama.bamapp.bamapppp has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{424fd9e8 V.E..... R.....ID 0,0-698,384} that was originally added here

02-19 01:45:30.325: E/WindowManager(30813): android.view.WindowLeaked: Activity com.bama.bamapp.bamapppp has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{424fd9e8 V.E..... R.....ID 0,0-698,384} that was originally added here

02-19 01:45:30.325: E/WindowManager(30813): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)

02-19 01:45:30.325: E/WindowManager(30813): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)

02-19 01:45:30.325: E/WindowManager(30813): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)

02-19 01:45:30.325: E/WindowManager(30813): at android.app.Dialog.show(Dialog.java:281)

02-19 01:45:30.325: E/WindowManager(30813): at android.app.AlertDialog$Builder.show(AlertDialog.java:951)

02-19 01:45:30.325: E/WindowManager(30813): at org.apache.cordova.CordovaChromeClient.onJsAlert(CordovaChromeClient.java:137)

02-19 01:45:30.325: E/WindowManager(30813): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:575)

02-19 01:45:30.325: E/WindowManager(30813): at android.os.Handler.dispatchMessage(Handler.java:99)

02-19 01:45:30.325: E/WindowManager(30813): at android.os.Looper.loop(Looper.java:137)

02-19 01:45:30.325: E/WindowManager(30813): at android.app.ActivityThread.main(ActivityThread.java:5191)

02-19 01:45:30.325: E/WindowManager(30813): at java.lang.reflect.Method.invokeNative(Native Method)

02-19 01:45:30.325: E/WindowManager(30813): at java.lang.reflect.Method.invoke(Method.java:511)

02-19 01:45:30.325: E/WindowManager(30813): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)

02-19 01:45:30.325: E/WindowManager(30813): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)

02-19 01:45:30.325: E/WindowManager(30813): at dalvik.system.NativeStart.main(Native Method)

 

If it can be useful during the launch of the World I also get the following errors:

 

02-19 01:44:47.495: E/(30813): void __egl_platform_dequeue_buffer(egl_surface*):1200 failed to dequeue buffer from native window (0x5c88cbf0); err = -19, buf = 0x5a552e44

02-19 01:44:47.710: E/libEGL(30813): called unimplemented OpenGL ES API

02-19 01:44:47.755: E/Web Console(30813): Uncaught ReferenceError: AR is not defined at null:1

02-19 01:44:52.945: E/AR(30813): VideoBackgroundConfig with screen size of zero received, skipping config step

 

Thanks, Carlo.

Hi Carlo,

Thanks for your interest in Wikitude's phonegap plugin.
Unfortunately latest phonegap update caused breaking changes in the Wikitude Plugin.

We'll publisha n update end of February 2013 on github.

Stay tuned.

Regards,
Andi

I come back to Phonegap 2.2.0 (as reported in yours tutorial) but happens the same problem. Any Idea? 

 

 

Hi once again!

In fact we also tested on some more devices and also came up with an overall fix for your described issue.
please stay tuned for the update next week.

Kind regards,
Andreas

Thanks Andreas, now i have understood. :) 

I need this fix because otherwise the app is useless ... so i stay tuned and wait here in front of the screen from now :)

I wish you well.

ps: to temporarily work around this problem, it is possible to create a <button> in android to close wikitude world? i havent found anything .. 

Thanks for your patience ;-)

Please create a button in that calls WikitudePlugin.close() and removes the "backbutton" listener to workaround the issue in the meantime.

Hope that helps.

Kind regards,
Andreas

ok, but how can i call WikitudePlugin.close() in wikitude world ? "WikitudePlugin" is a var of Phonegap .. how can i access it? i ask this because i'm not expert and probably the solution is simple but i don't know it..

Thanks, Carlo.

Hi again,

 

you may define button action


document.location = 'architectsdk://clickedClose"

and fetch the event inside the urlInvoceEventListener defined using


WikitudePlugin.setOnUrlInvokeCallback(yourFunction);

in "yourFunction" you can then call WikitudePlugin.close().
the url (in this case "architectsdk://clickedClose") will be passed as solely/first argument in "yourFunction"

Cheers,
Andi
Login or Signup to post a comment