Disabling Android optimizations for Android <4.4 (solved)


I recently added Crosswalk to my project to navigate around some of Android’s WebView quirks. But now, when I run my app under Android <4.4, Ionic still adds Android <4.4 optimizations like some extra padding for icons in the tab bar. Since these optimizations are not needed anymore, they are more hurtful then helpful.

Is there any way to tell Ionic to behave like it runs under Android 4.4?


So I made some progress on this front that I wanted to share:

Right now, I can check whether the app runs under a version lower than Android 4.4 like this:

if(ionic.Platform.platform() === “android” && ionic.Platform.version() < 4.4)

I can also set the version but this has no effect :frowning:


I also found out that if I set the class of the HTML-body to platform-android4_4 everything behaves like I would want it to.

body class=“platform-android4_4”

Unfortunately, I haven’t found a way so far to combine these two aspects in a meaningful way.

Edit: Figured it out.
The version has to be set as early as possible. For me, it worked to set the version inside the app.run() function like this:

// We are using Crosswalk which gives us a browser with capabilities similar
// the one that comes with Android 4.4.
// Therefore, tell ionic to behave like it runs under Android 4.4.
if(ionic.Platform.platform() === “android” && ionic.Platform.version() < 4.4){

Hope this can help others :smile: