Skip to content

Commit

Permalink
Remove warning about missing access token on Android (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
m0nac0 authored Oct 8, 2021
1 parent 0005a6c commit f44a2b8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions android/src/main/java/com/mapbox/mapboxgl/MapBoxUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ private static String getAccessToken(@NonNull Context context) {
.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
String token = bundle.getString("com.mapbox.token");
if (token == null || token.isEmpty()) {
throw new NullPointerException();
if (token == null ) {
token = "";
}
return token;
} catch (Exception e) {
Log.e(TAG, "Failed to find an Access Token in the Application meta-data. Maps may not load correctly. " +
"Please refer to the installation guide at https://github.com/tobrun/flutter-mapbox-gl#mapbox-access-token " +
"for troubleshooting advice." + e.getMessage());
} catch (PackageManager.NameNotFoundException e) {
return "";
}
return null;

}
}

0 comments on commit f44a2b8

Please sign in to comment.