Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] MapboxAccountManager cannot be restarted #7584

Closed
ghost opened this issue Jan 3, 2017 · 3 comments
Closed

[android] MapboxAccountManager cannot be restarted #7584

ghost opened this issue Jan 3, 2017 · 3 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@ghost
Copy link

ghost commented Jan 3, 2017

Platform: Android
Mapbox SDK version: 4.2.1

MapboxAccountManager is singleton and can be started only once with given access token. This is a problem for "showcase" apps which uses multiple Mapbox accounts (access token + style url combinations) in different Activities.

public static MapboxAccountManager start(Context context, String accessToken) {
        if (mapboxAccountManager == null) {
             // init some stuff
        }
        return mapboxAccountManager;
    }

Workaround would be to use MapboxMapOptions.accessToken() but it is deprecated and assumably going away in the future. However, it can be used to initialise MapboxMap and MapView with different access tokens within the same app.

Suggested solutions:

  1. check accessToken in MapboxAccountManager.start(). If it was different than in previous run, reset whole thing.

or

  1. Implement MapboxAccountManager.stop() which would reset whole thing.
@tobrun
Copy link
Member

tobrun commented Jan 3, 2017

@olliSP thank you for reaching out and explaining your issue. Note that we have removed MapboxAccountManager on the master branch and now working towards using Mapbox instead. I think exposing a setter their would solve the issue for you. Before loading a MapView you can call into Mapbox#setAccessToken(String) to change the current active accesstoken.

@cammace cammace added the Android Mapbox Maps SDK for Android label Jan 3, 2017
@ghost
Copy link
Author

ghost commented Jan 5, 2017

Hi @tobrun ,

Thank you for the heads-up! I think public setter would work for us.

Cheers!

@lilykaiser
Copy link

Closing because this ticket refers to deprecated code. If this is still a problem, please feel free to reopen. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

3 participants