diff --git a/app/src/main/assets/app_config/configure.html b/app/src/main/assets/app_config/configure.html index a4d10e985..dd77ad431 100644 --- a/app/src/main/assets/app_config/configure.html +++ b/app/src/main/assets/app_config/configure.html @@ -1,6 +1,7 @@ - + +

Url of the configuration:

-
- - +
+ +

Incoming configuration data:

-
- +
+
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java index 9e783eb5b..f6138fb68 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ExternalPebbleJSActivity.java @@ -7,7 +7,9 @@ import android.os.Bundle; import android.support.v4.app.NavUtils; import android.util.Log; import android.view.MenuItem; +import android.webkit.ConsoleMessage; import android.webkit.JavascriptInterface; +import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; @@ -64,6 +66,7 @@ public class ExternalPebbleJSActivity extends Activity { WebView myWebView = (WebView) findViewById(R.id.configureWebview); myWebView.clearCache(true); myWebView.setWebViewClient(new GBWebClient()); + myWebView.setWebChromeClient(new GBChromeClient()); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); //needed to access the DOM @@ -90,6 +93,13 @@ public class ExternalPebbleJSActivity extends Activity { return null; } + private class GBChromeClient extends WebChromeClient { + @Override + public boolean onConsoleMessage(ConsoleMessage consoleMessage) { + GB.toast(consoleMessage.message(), Toast.LENGTH_LONG, GB.ERROR); + return super.onConsoleMessage(consoleMessage); + } + } private class GBWebClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {