Coder Social home page Coder Social logo

isabella232 / engine-braze-integration-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from factual/engine-braze-integration-android

0.0 0.0 0.0 455 KB

Factual Engine / Braze Integration for Android

Home Page: http://www.factual.com

License: MIT License

Java 100.00%

engine-braze-integration-android's Introduction

Factual / Braze SDK for Android Build Status

This repository contains the code for an integration between Factual's Engine SDK and Braze's Mobile SDK. Using this library you can configure Factual's Location Engine SDK to send custom events to Braze to better understand users in the physical world and build personalized experiences to drive user engagement and revenue.

Integration with Braze UI

see: engine-braze-integration

Installation

The project artifacts are available from Factual's Bintray Maven repository.

// repository for the Factual artifacts
repositories {
  maven {
    url "https://factual.bintray.com/maven"
  }
}

...

dependencies {
  compile 'com.factual.engine:braze-engine:3.0.0'
}

Usage

Requirements

  • Configured and started Engine client. see here
  • Configured Braze client. see here

Tracking Factual Engine Circumstances

Start tracking Factual Engine circumstances by calling BrazeEngineIntegration.pushToBraze() in the onCircumstancesMet() callback of FactualClientReceiver.

public class ExampleFactualClientReceiver extends FactualClientReceiver {

    @Override
    public void onCircumstancesMet(List<CircumstanceResponse> responses) {
      /*
      Max number of "engine_at_" events that should be sent per "engine_" + CIRCUMSTANCE_NAME.
      Default is set to 10.
      */
      int maxAtPlaceEvents = 3;

      /*
      Max number of "engine_near_" events that should be sent per "engine_" + CIRCUMSTANCE_NAME.
      Default is set to 20.
      */
      int maxNearPlaceEvents = 5;
      for (CircumstanceResponse response : responses) {
        /* Send circumstance event to braze */
        BrazeEngineIntegration.pushToBraze(getContext().getApplicationContext(),
              response,
              maxAtPlaceEvents,
              maxNearPlaceEvents);
    }
  }

  ...

}

Be sure to assign the Client Receiver when initializing Engine.

public void initializeEngine() {
    FactualEngine.initialize(this,
        Configuration.ENGINE_API_KEY,
        ExampleFactualClientReceiver.class);
}

Tracking Factual Engine User Journey Spans

Start tracking spans by setting the user journey receiver in the onInitialized() callback of FactualClientReceiver.

@Override
public void onInitialized() {
  try {
    FactualEngine.setUserJourneyReceiver(BrazeEngineUserJourneyReceiver.class);
    FactualEngine.start();
  } catch (FactualException e) {
    Log.e("engine", e.getMessage());
  }
}

Then call BrazeEngineIntegration.trackUserJourneySpans() in the onStarted() method of FactualClientReceiver.

public class ExampleFactualClientReceiver extends FactualClientReceiver {
  @Override
  public void onStarted() {
    Log.i("engine", "Engine has started.");
    /*
    Max number of "engine_span_attached_place" events that should be sent per
    "engine_span_occurred". Default is set to 20.
    */
    int maxAttachedPlaceEventsPerSpan = 10;

    /* Start tracking spans */
    BrazeEngineIntegration.trackUserJourneySpans(getContext().getApplicationContext(),
        maxAttachedPlaceEventsPerSpan);
}

    ...
}

Please refer to the Factual Developer Docs for more information about Engine.

Example App

An example app is included in this repository to demonstrate the usage of this library, see ./example for documentation and usage instructions.

engine-braze-integration-android's People

Contributors

cmbleakley avatar david-boulanger avatar nnlamb25 avatar zevada avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.