0

I am using crosswalk to better support older android devices. But app has 5% CPU even doing nothing and even in idle state on background.

Removing crosswalk from project solves problem, but I want it to stay included because of the benefits.

Luckylooke
  • 4,061
  • 4
  • 36
  • 49

1 Answers1

0

I have found two things what makes the CPU. 1. animated gif image 2. bug in ionic wrapper of device motion cordova plugin (acceleration watcher never stop then)

  1. animated gif: I had animated gif as loading spinner in my index.html while my app becomes available. On mobile phones it was not visible at all, because splash screen is turned off after app init, but it was for browser use. Removing this gif solves about 3% CPU

  2. I have device motion plugin in my app and I was using it as described in ionic docs, so if not needed anymore I have called unsubscribe. But ionic was not calling clearWatch method correctly (with wathID parameter), so the watcher never stops. It caused another ~3% CPU. As an workaround I have used plugin directly, bypassing ionic wrapper as described in cordova docs.

Removing those two problems I get approximately 0.4% CPU which I think is the lowest minimum, because I have tested empty index.html builded into cordova app even without the crosswalk and still getting the minimum 0.4% CPU usage.

Hope that this help someone else, happy coding ;)

Luckylooke
  • 4,061
  • 4
  • 36
  • 49