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.

Create Android EventManager #2422

Closed
Closed

Description

@ljbade

For metrics (#2421) we need an Android equivalent of Mapbox's MGLMapboxEvents.

Following Android conventions it will be called EventManager.

Features:

  • performs event queue processing on a background low priority thread
  • all functions are threadsafe
  • uses OkHTTP along with SSL pinning for upload
  • uses network request coalescing to reduce battery drain
  • can be paused and resumed
  • fulfils our data lifetime guarantees
  • checks network status before upload

Activity

  1. added
    Android
    telemetry
    on Sep 25, 2015
  2. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    Will be working on the android-metrics branch.

    First step will be to define a POJ Events object that will hold our supported data.

    I will copy the iOS properties for the moment, but will need to go back and work out more Android specific properties.

  3. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    Next is to create the singleton EventManager.

  4. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    Hmm looking at the Android docs we want to use a background service to handle event processing and uploading.

  5. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    I created a EventService that end developers will have to add to their application manifest.

    It is started by EventManager.pushEvent and will return a status via LocalBroadcastManager.

    The EventService will handle the data upload.

  6. tobrun commented on Sep 25, 2015

    @tobrun
    Member

    This is great 👍
    Just one minor remark:

    end developers will have to add to their application manifest.

    I'm personally not a big fan of this, if end developer ignore this we will not receive any metrics..

  7. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    @tobrun Unfortunately I can't see a way around this. Using background services on Android requires a <service> in the manifest.

    We can add a check in MapView that will throw if the service has not started with a description that explains they need to add the service to the manifest.

  8. ljbade commented on Sep 25, 2015

    @ljbade
    ContributorAuthor

    Anyway current branch has very rough EventManager that manages to upload a turnstile event and gets a HTTP 400 back from the server.

    Things to work on:

    • pause/resume
    • better way to get access token - might move this into pushEvent since multiple MapViews could mean multiple keys...
    • automatically fire turnstile event on either creation of EventManager or MapView
    • make EventManager singleton again (once we remove access key to pushEvent)
    • determine if using test server somehow
    • implement all the non location events
    • check connectivity and batch/queue events ready for upload when it reconnects
  9. tobrun commented on Sep 25, 2015

    @tobrun
    Member
    • If we execute an Asynctask in pushEvent() we could remove dependency on Service.

    • During singleton creation it is better to enforce the application context

      public static synchronized EventManager getInstance(Context context) {
      if (sInstance == null) {
         sInstance = new EventManager(context.getApplicationContext());
      }
      return sInstance;
      }
      
  10. tobrun commented on Jan 11, 2016

    @tobrun
    Member

    I believe this issue is out of date and is tracked elsewhere.

    cc @bleege

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidtelemetry

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions