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

Introduce MapboxAccountManager #5004

Closed
Closed

Description

@bleege

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.

Activity

  1. self-assigned this
    on May 11, 2016
  2. added
    Android
    on May 11, 2016
  3. added this to the android-v4.1.0 milestone on May 11, 2016
  4. added a commit that references this issue on May 11, 2016
  5. zugaldia commented on May 11, 2016

    @zugaldia
    Member

    /sub

  6. tmcw commented on May 11, 2016

    @tmcw
    Contributor

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

  7. added 4 commits that reference this issue on May 13, 2016
  8. bleege commented on May 13, 2016

    @bleege
    ContributorAuthor

    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.

  9. added a commit that references this issue on May 13, 2016
  10. bleege commented on May 13, 2016

    @bleege
    ContributorAuthor

    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.

  11. added 3 commits that reference this issue on May 13, 2016
  12. bleege commented on May 13, 2016

    @bleege
    ContributorAuthor

    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.

  13. added 3 commits that reference this issue on May 15, 2016
  14. bleege commented on May 15, 2016

    @bleege
    ContributorAuthor

    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()
  15. added a commit that references this issue on May 15, 2016
  16. bleege commented on May 15, 2016

    @bleege
    ContributorAuthor

    Squashed, Rebased, and Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions