Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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) ?

like image 407
Cédric Avatar asked Oct 02 '14 19:10

Cédric


People also ask

Is WebView slower than browser?

Web View is slower on both as compared to native android browser.

How can I improve my WebView performance?

I read about how to increase performance of WebView by implementing Caching web resources like JS, CSS and image files. You can also static resources in your native application, and by intercepting the Resource requests you can override the default behaviour of WebView.

Does Cordova use Android WebView?

Beginning in Cordova 1.9, with the assistance of the CordovaActivity , you can use Cordova as a component in a larger native Android application. Android refers to this component as the CordovaWebView .

Is Cordova just a WebView?

Cordova's user interface is WebView. Cordova application is compiled but it doesn't take CSS, JavaScript, or HTML code. It converts applications into specific native codes with respect to various platforms.


1 Answers

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.

like image 101
LeftyX Avatar answered Sep 21 '22 17:09

LeftyX