i have problem when trying to load my javascript function from java with Phonegap for Android. Everytime when i call the
loadUrl("javascript:myJavascriptFunction()");
i always have this error
I/System.out( 2822): loadUrl(javascript:myJavascriptFunction())
I/System.out( 2822): url=javascript:myJavascriptFunction() baseUrl=file:///android_asset/www/
D/PhoneGapLog( 2822): file:///android_asset/www/phonegap-1.1.0.js: Line 920 : JSCallback Error: Service unavailable. Stopping callbacks.
I can see that my javascript is actually called. But after about 10 seconds, my app quits because of this error:
I/System.out( 2822): onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=javascript:myJavascriptFunction()
E/WindowManager( 2822): android.view.WindowLeaked: Activity com.phonegap.plugin.billing.CallbackBillingActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405d9860 that was originally added here
E/WindowManager( 2822): at android.view.ViewRoot.<init>(ViewRoot.java:258)
E/WindowManager( 2822): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
Can anyone can explain me where is the problem? Thanks
Answer that i get from phonegap google group:
this.ctx.sendJavascript("myJavaScriptFunction");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With