Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 833
Peacemoon Avatar asked Nov 06 '11 17:11

Peacemoon


1 Answers

Answer that i get from phonegap google group:

 this.ctx.sendJavascript("myJavaScriptFunction");
like image 134
Peacemoon Avatar answered Sep 27 '22 18:09

Peacemoon