Package com.castlabs.android.player
Class CLLibraryLoader
java.lang.Object
com.castlabs.android.player.CLLibraryLoader
The library loader class is a class that provides static methods to register native libraries that will be
loaded on request.
The class will load `gnustl_shared` first, then the registered libraries in order of registration
and the the castLabs player libraries.
In addition to library names, you can also register
CLLibraryLoader.PostLoadAction
instances. Registered implementations of this interface will be executed once after libraries are loaded.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Register instances of this interface to call custom code triggered after all native libraries are loaded. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
load()
Call this method to load the registered native libraries and execute the post load actions.static void
register
(CLLibraryLoader.PostLoadAction postLoadAction) Register a new post load action that will be executed by the loader after the native libraries are loaded.static void
Register a library that needs to be loaded.
-
Field Details
-
ENABLED
public static boolean ENABLEDThe library loader can be disabled. This is useful for unit tests where the native libraries can not be loaded
-
-
Method Details
-
register
Register a library that needs to be loaded. NOTE that the name is the base name of the library without the "lib" prefix and without the ".so" suffix! For example, say you want to load libgnustl_shared.so that is distributed with your app. In this case you need to register "gnustl_shared" with this method- Parameters:
name
- the library base name, i.e. "gnustl_shared"
-
register
Register a new post load action that will be executed by the loader after the native libraries are loaded.- Parameters:
postLoadAction
- the post load action- Throws:
IllegalStateException
- in case the libraries are already loaded
-
load
public static void load()Call this method to load the registered native libraries and execute the post load actions. *NOTE* that you usually do *NOT* need to call this method explicitly. The framework will take care of library loading for you.
-