android: Add possibility to debug JS in the WebView using a debugger.
Change-Id: I3d14dce55c7c94a151e72b631925419b4c313297
This commit is contained in:
parent
12fa2aafa0
commit
63b1853cd2
2 changed files with 10 additions and 0 deletions
|
@ -18,6 +18,7 @@ android {
|
|||
//abiFilters "x86", "armeabi-v7a", "armeabi"
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
debuggable true
|
||||
}
|
||||
release {
|
||||
ndk {
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.libreoffice.androidapp;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
@ -135,6 +136,14 @@ public class MainActivity extends AppCompatActivity {
|
|||
webSettings.setJavaScriptEnabled(true);
|
||||
mWebView.addJavascriptInterface(this, "LOOLMessageHandler");
|
||||
|
||||
// allow debugging (when building the debug version); see details in
|
||||
// https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
mWebView.loadUrl("file:///android_asset/dist/loleaflet.html?file_path=" +
|
||||
urlToLoad +
|
||||
"&closebutton=1&permission=edit" +
|
||||
|
|
Loading…
Reference in a new issue