Android & Phonegap: error occurs when loading javascript using loadUrl function

I have a problem while trying to load a javascript function from java using Phonegap for Android. Every time i call

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 see what my javascript is actually called. But after about 10 seconds, my application crashes due to 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 someone explain to me where the problem is? Thanks

+5
source share
1 answer

The answer I get from google phonegap group is:

 this.ctx.sendJavascript("myJavaScriptFunction");
+6
source

All Articles