Ask Your Question

Revision history [back]

Using default BaseLoaderCallback in an android service

0 down vote favorite

I want to use OpenCV in an android service. In the OpenCV documentation I found the following information:

Default BaseLoaderCallback implementation treats application context as Activity and calls Activity.finish() method to exit in case of initialization failure. To override this behavior you need to override finish() method of BaseLoaderCallback class and implement your own finalization method.

But now I don't now how I should implement my own finalization method. What should I do in this method?

And another question: Where should I place the following line of code:

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, this, mOpenCVCallBack)

In an android activity this line of code should be in the onResume(), but in an android service I don't an onResume() method.