My cordova webview app is really slower than in the android browser on the same phone

Cédric picture Cédric · Oct 2, 2014 · Viewed 11.5k times · Source

I built an android app with ionicframework and cordova.

But when i try to run on my Samsung Galaxy S4 the app is really slower than the same code in the webbrowsers of my phone.

How can i expect to have the same perfs ?

I've tried :

android:hardwareAccelerated="true"

this.appView.getSettings().setRenderPriority(RenderPriority.HIGH);
this.appView.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON_DEMAND);

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />

With the last 3.6 cordova version

How can i do to have the same performance as i can see on the phone browser (with meta app-capable for example) ?

Answer

LeftyX picture LeftyX · Oct 22, 2014

It's hard to tell as you haven't provided code or a sample.
If you're not using the latest Android 4.4 KitKat, chances are you're using a really old WebView.

Older versions of Android devices (4.0-4.3) use Android’s default browser, which has significantly less performance and standards compliance than modern Chrome. Using Crosswalk gives you a specific and more performant version of Chrome to use on all Android devices, in order to reduce fluctuations and fragmentation among devices.

This article goes deeper in the problem and it's worth reading.

If you want to achieve the same performances you have in your web browser you can replace your web runtime using Crosswalk.

Crosswalk can be easily integrated with Cordova.

With ionic framework you can simply:

ionic browser add crosswalk

If you'd like to specify a different version of Crosswalk, run ionic browser list to see which browsers are available and what versions. Then run:

ionic browser add [email protected]

Nick Raboy has written an interesting article which will guide you through all the step you need to take to integrate Crosswalk with Cordova + Ionic Framework.

Very helpful is the video with explains everything in a simple way.

Crosswalk can also be used in Shared Mode:

"Shared mode" allows multiple Crosswalk applications to share one Crosswalk runtime. If the runtime is not already installed in the device, it will be downloaded either from the Google Play Store, or from a download location specified by the developer. When using this feature, the Crosswalk library is not included in the application's package, making it significantly smaller.

Producing a significant smaller APK file size.

It is not yet integrated in ionic framework and There is no road map to include this feature.