Card.io performance very slow on Nexus 10

219 Views Asked by At

I have implemented card.io into an app and the performance when opening the credit card scanning activity (CreditIOActivity) opens quickly on most devices. But on the Nexus 10, running Android 4.4.2, it can take as much as 5 seconds for the scanning activity to load when called from my app. Though this long delay does NOT occur in the sample app card.io provides with their SDK. I am thinking it may be a memory issue causing the slow load time when opening from within my app, but that does not explain why the performance is near identical to the sample app on other devices.

All help is greatly appreciated.

2

There are 2 best solutions below

3
tomwhipple On BEST ANSWER

Are you checking CardIOActivity.canReadCardWithCamera(this) in your activity's onResume() or similar? There's some static initialization that card.io needs. If it can be triggered early, it doesn't have to happen when the user is waiting.

0
Jeff Brateman On

The SampleApp does indeed experience the same performance problems, it just does it on app startup. CardIOActivity.canReadCardWithCamera(this) can take up to 4 seconds on the Nexus 10. I fiddled around and found that calling CardIOActivity.canReadCardWithCamera(this) on an AsyncTask greatly improves the user experience. I recommend starting the AsyncTask when a user enters the activity immediately before they would be asked to scan a card. Even earlier would be more ideal, but becomes harder to manage.

In the case that the user attempts to scan a card before this method returns, Card.io gracefully falls back to manual entry.