I am trying to publish my android app created with cordova and while publishing I followed all steps like android:debuggable="false" or even removing this line as its the latest suggestion but the problem is when I install the signed build version in my emulator I am able to debug it ... any help?
Update:-
As per suggestion I tried ..
public class appname extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
super.loadUrl(Config.getStartUrl());
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
if(0 != (getApplicationInfo().flags = ApplicationInfo.FLAG_DEBUGGABLE)){
//Log.i("Your app", "Disable web debugging");
WebView.setWebContentsDebuggingEnabled(false);
}
}
}
}
in public void onCreate(Bundle savedInstanceState){}
Found this piece of code in CordovaWebView.java
if((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
{
setWebContentsDebuggingEnabled(true); // I tried setting this false as well
}
But its still not working...am still able to debug html js files
You have to set your webview not debuggable:
WebView.setWebContentsDebuggingEnabled(false)
. I have checked:
public class HTML5Application extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
//webView.setWebChromeClient(new WebChromeClient());
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html")
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
Log.i("xxxxxx", "Enabling web debugging");
OnlyForKitKat.enableWebViewDebugging();
}
appView.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) return true;
return false;
}
});
}
and
@SuppressLint("NewApi")
public class OnlyForKitKat {
public static void enableWebViewDebugging() {
WebView.setWebContentsDebuggingEnabled(false);
}
}
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