Since Chrome has an awesome feature for remote debugging, I am wondering how this could help in developing in Worklight.
In the following docs they say to debug the contents of your WebView, you need to enable it programmatically from within your application by calling setWebContentsDebuggingEnabled, a static method on the WebView class.
Where can I find this class and will this be beneficial to do it in Worklight?
https://developers.google.com/chrome-developer-tools/docs/remote-debugging?hl=nl#debugging-webviews
Configure Android WebViews to debug To turn on Android WebView debugging, run the setWebContentsDebuggingEnabled static method on the WebView class. The setting applies to all of the Android WebViews of the app. Android WebView debugging isn't affected by the state of the debuggable flag in the manifest of the app.
Please note that WebView debugging is only relevant for Android 4.4 "KitKat" and not to any prior version of the Android OS.
To debug your Chromium WebView in a Worklight application with the Android environment,
yourAppName\android\native\AndroidManifest.xml
you add support for targetSdkVersion=19
.
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
Android 4.4
:yourAppName\android\native\src\com\yourAppName\yourAppName.java
andimport android.os.Build; import android.util.Log; import android.content.pm.ApplicationInfo; import android.webkit.WebView;
onCreate()
function:if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ if(0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)){ WebView.setWebContentsDebuggingEnabled(true); } }
The rest of the steps are as described in the Google documentation page.
I don't have an Android device to verify this, so please try.
As for whether it is beneficial or not, another debugging alternative can't hurt. It is up to you to decide if it's good or not, for you.
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