public void onCreate() { Log.i(TAG, "Service starting"); super.onCreate(); Log.i(TAG, "Engine binder component creating"); mMarket = new MarketConnector(getBaseContext()); mNativeBinder = new BinderConnector(mMarket); if (mNativeBinder.Init()) { mEngineInterface = mNativeBinder.Connect(); Log.i(TAG, "Service started successfully"); } else { Log.e(TAG, "Cannot initialize native part of OpenCV Manager!"); Log.e(TAG, "Using stub instead"); mEngineInterface = new OpenCVEngineInterface.Stub() { @Override public boolean installVersion(String version) throws RemoteException { // TODO Auto-generated method stub return false; } @Override public String getLibraryList(String version) throws RemoteException { // TODO Auto-generated method stub return null; } @Override public String getLibPathByVersion(String version) throws RemoteException { // TODO Auto-generated method stub return null; } @Override public int getEngineVersion() throws RemoteException { return -1; } }; } }
public void OnDestroy() { Log.i(TAG, "OpenCV Engine service destruction"); mNativeBinder.Disconnect(); }