Example usage for org.apache.cordova BuildConfig DEBUG

List of usage examples for org.apache.cordova BuildConfig DEBUG

Introduction

In this page you can find the example usage for org.apache.cordova BuildConfig DEBUG.

Prototype

boolean DEBUG

To view the source code for org.apache.cordova BuildConfig DEBUG.

Click Source Link

Usage

From source file:com.evothings.acmelauncher.MainActivity.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        // Detect all manner of bad things.
        // This code is active only in debug builds.
        /*//  www .ja  v  a  2 s .c om
        // Cordova does disk access; don't enable this check.
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
           .detectAll()
           .penaltyLog()
           .penaltyDeath()
           .build());
        */
        StrictMode
                .setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().penaltyDeath().build());
    }
    super.onCreate(savedInstanceState);
    super.init();

    // If the intent has a data string we load it.
    Intent intent = getIntent();
    if (!openEvothingsIntent(intent)) {
        // If the intent is not an evo/evos URL, open the start page.
        // This is the original Cordova page loading code.
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html")
    }
}

From source file:com.evothings.evothingsclient.Evothings.java

License:Apache License

@Override
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        // Detect all manner of bad things.
        // This code is active only in debug builds.
        /*//  w w w .  j  ava2 s  .com
        // Cordova does disk access; don't enable this check.
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
           .detectAll()
           .penaltyLog()
           .penaltyDeath()
           .build());
        */
        StrictMode
                .setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().penaltyDeath().build());
    }
    super.onCreate(savedInstanceState);
    super.init();

    // If the intent has a data string we load it.
    Intent intent = getIntent();
    if (isEvothingsIntent(intent)) {
        openEvothingsIntent(intent);
    } else {
        // This is the original Cordova page loading code.
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());
        //super.loadUrl("file:///android_asset/www/index.html")
    }
}

From source file:com.example.administrator.myapplication.fragment.CordovaFragment2.java

License:Apache License

protected void init() {
    appView = makeWebView();/*from  w  w  w. j  a  v  a2  s . c  o  m*/
    createViews();
    if (!appView.isInitialized()) {
        appView.init(cordovaInterface, pluginEntries, preferences);
    }
    cordovaInterface.onCordovaInit(appView.getPluginManager());

    // Wire the hardware volume controls to control media if desired.
    String volumePref = preferences.getString("DefaultVolumeStream", "");
    if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
        getActivity().setVolumeControlStream(AudioManager.STREAM_MUSIC);
    }

    if (BuildConfig.DEBUG) {
        ((WebView) appView.getView())
                .setWebViewClient(new SystemWebViewClient((SystemWebViewEngine) appView.getEngine()) {
                    @Override
                    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
                        handler.proceed();
                    }
                });
    }
}