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

Introduce MapboxAccountManager #5004

Closed
bleege opened this issue May 11, 2016 · 7 comments
Closed

Introduce MapboxAccountManager #5004

bleege opened this issue May 11, 2016 · 7 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@bleege
Copy link
Contributor

bleege commented May 11, 2016

MapboxAccountManager will be a centralized place for developers to configure their apps to use Mapbox technology on Android. This will be the preferred (and ultimately only as of 5.0.0) place to set the app's Access Token. The use case for the developer will be to configure it in the onCreate() method of either:

  1. The App's Custom Application object (if app uses one)
  2. The App's launch Activity
// Setup call
MapboxAccountManager.start("Mapbox Access Token");

While implementing this we'll immediately mark the setAccessToken() and getAccessToken() in MapView and MapboxMap as deprecated starting in 4.1.0 with the goal of removing them as of 5.0.0.

@bleege bleege self-assigned this May 11, 2016
@bleege bleege added the Android Mapbox Maps SDK for Android label May 11, 2016
@bleege bleege added this to the android-v4.1.0 milestone May 11, 2016
@zugaldia
Copy link
Member

/sub

@tmcw
Copy link
Contributor

tmcw commented May 11, 2016

@zugaldia you can subscribe with the button on the right :)

bleege added a commit that referenced this issue May 13, 2016
bleege added a commit that referenced this issue May 13, 2016
…nitialize telemetry depending on developer implementation
@bleege
Copy link
Contributor Author

bleege commented May 13, 2016

I've built out the basic MapboxAccountManager API and refactored the Telemetry initialization process to support being started in multiple locations (MapboxAcccountManager and MapView). I've successfully tested the MapView setup to confirm that it still starts and stops as it's always done. Next up is to convert the TestApp to use MapboxAccountManager and confirm that Telemetry works as desired there too.

bleege added a commit that referenced this issue May 13, 2016
@bleege
Copy link
Contributor Author

bleege commented May 13, 2016

I have now added MapboxAccountManager.start() to the TestApp's custom Application object called MapboxApplication while leaving the Access Token setup in the TestApp's activities that contained MapViews. Afterwards I successfully tested the Telemetry process and confirmed that it did start from the Application object and stopped itself from restarting when the different MapViews loaded.

Next up is to remove all the Access Token's from the TestApp's activities so that only MapboxAccountManager.start() is used. Once this is done we'll have both use cases implemented and tested.

@bleege
Copy link
Contributor Author

bleege commented May 13, 2016

I just refactored the TestApp to remove MapView.setAccessToken() uses, both programmatically and via Layout XML. The TestApp continued to work as expected relying on the MapboxAccountManager.start() in the Application object.

Things are looking pretty good overall. Just need to do another round of testing to confirm that things are as good as they currently appear as well as one last specific test of setting MapboxAccountManager.start() in an Activity's onCreate() method instead of the Application's.

@bleege
Copy link
Contributor Author

bleege commented May 15, 2016

Documenting Workflows

Ways To Set Access Token

  • MapboxAccountManager
  • MapView.setAccessToken()
  • MapboxMap.setAccessToken()
  • XML Layout

MapView Flow Chart (Each Step Is Progressive From Top To Bottom

  • MapView Constructors
    • Processes XML Layout via AttributeSet
    • Process MapboxMapOptions
  • MapView.initialize()
    • Common initialization routine for all constructors
  • MapView.setInitialState()
    • Sets Access Token via MapboxMap.setAccessToken()
      • Looks for MapboxAccountManager first
      • Looks for MapboxMapOptions (XML attributes or MapboxMapOptions Builder)
  • onCreate()
    • Validate Access Token

MapView.setAccessToken()

  • Called from MapboxMap.setAccessToken()
    • XML Layout is routed through MapboxMapOptions now

What Access Token Source Of Truth Is Being Used?

  • If MapboxAccountManager.getInstance() is null then it's MapView style.
  • If MapboxAccountManager.getInstance() is NOT NULL then it's MapboxAccountManager.

Deprecated Now, Will Be Removed in 5.0.0

  • MapboxMap.setAccessToken()
  • MapboxMap.getAccessToken()
  • MapView.setAccessToken()
  • MapView.getAccessToken()

@bleege
Copy link
Contributor Author

bleege commented May 15, 2016

Squashed, Rebased, and Merged!

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