mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-30 12:31:11 +00:00
ensure that MapboxAccountManager class is always created from the main thread; fixes crash from Android SDK 4.2.0-beta.4 and up (#517)
This commit is contained in:
committed by
Bobby Sudekum
parent
4453983022
commit
c0ebef23fb
@@ -138,7 +138,7 @@ public class ReactNativeMapboxGLModule extends ReactContextBaseJavaModule {
|
||||
// Access Token
|
||||
|
||||
@ReactMethod
|
||||
public void setAccessToken(String accessToken) {
|
||||
public void setAccessToken(final String accessToken) {
|
||||
if (accessToken == null || accessToken.length() == 0 || accessToken.equals("your-mapbox.com-access-token")) {
|
||||
throw new JSApplicationIllegalArgumentException("Invalid access token. Register to mapbox.com and request an access token, then pass it to setAccessToken()");
|
||||
}
|
||||
@@ -150,7 +150,12 @@ public class ReactNativeMapboxGLModule extends ReactContextBaseJavaModule {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
MapboxAccountManager.start(context.getApplicationContext(), accessToken);
|
||||
mainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MapboxAccountManager.start(context.getApplicationContext(), accessToken);
|
||||
}
|
||||
});
|
||||
initializeOfflinePacks();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user