blob: 65f8eec03bfd90e4d65ee4ffd8ddc2dd37bf2a48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package com.mapbox.mapboxsdk;
import android.content.Context;
import java.io.File;
/**
* Centralises the knowledge about "mapbox-gl" library loading.
*/
public class LibraryLoader {
private static final String LIBRARY_NAME = "libmapbox-gl.so";
/**
* Loads "libmapbox-gl.so" native shared library.
* @param context The application context
*/
public static void load(Context context) {
try {
System.loadLibrary("mapbox-gl");
} catch (UnsatisfiedLinkError error) {
if (context != null) {
System.load(getLibraryLocation(context).getAbsolutePath());
}
}
}
/**
* Returns a file in the app internal storage that may contain a locally cached copy
* of the Mapbox native library.
*
* @param context The application context
* @return a file object
*/
public static File getLibraryLocation(Context context) {
return new File(context.getFilesDir(), LIBRARY_NAME);
}
}
|