lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/analytics/internal/BMSAnalytics.java
static public void init(Application app, String applicationName, String clientApiKey, boolean hasUserContext, boolean collectLocation, Analytics.DeviceEvent... contexts) {

        Context context = app.getApplicationContext();
        if (collectLocation) {
            locationService = MFPAnalyticsLocationListener.getInstance(context);
        }
            //Initialize LogPersister
        LogPersister.setLogLevel(Logger.getLogLevel());
        LogPersister.setContext(context);

        //Instrument Logger with LogPersisterDelegate
        LogPersisterDelegate logPersisterDelegate = new LogPersisterDelegate();
        Logger.setLogPersister(logPersisterDelegate);

        MFPInAppFeedBackListner.setContext(context);

        Analytics.setAnalyticsDelegate(new BMSAnalyticsDelegate());

        BMSAnalytics.clientApiKey = clientApiKey;

        if(contexts != null){
            for(Analytics.DeviceEvent event : contexts){
                switch(event){
                    case LIFECYCLE:
                        MFPActivityLifeCycleCallbackListener.init(app);
                        break;
                    case NETWORK:
                        isRecordingNetworkEvents = true;
                        break;
                    case ALL:
                        MFPActivityLifeCycleCallbackListener.init(app);
                        isRecordingNetworkEvents = true;
                        break;
                    case NONE:
                        break;
                }
            }
        }

         //if (!hasUserContext) {
         //    Use device ID as default user ID:

         //}

	    if (collectLocation) {
            BMSAnalytics.collectLocation = collectLocation;
            locationService.init();
        }

        DEFAULT_USER_ID = getDeviceID(context);
        if(!collectLocation)
        {
            setUserIdentity(DEFAULT_USER_ID,true);
        }

        BMSAnalytics.hasUserContext = hasUserContext;
        appName = applicationName;

        //Intercept requests to add device metadata header
        BaseRequest.registerInterceptor(new MetadataHeaderInterceptor(context.getApplicationContext()));
        BaseRequest.registerInterceptor(new NetworkLoggingInterceptor());

        enable();

        MFPInAppFeedBackListner.sendAppFeedback();
    }
static public void init(Application app, String applicationName, String clientApiKey, boolean hasUserContext, boolean collectLocation, Analytics.DeviceEvent... contexts) {

        Context context = app.getApplicationContext();
        if (collectLocation) {
            locationService = MFPAnalyticsLocationListener.getInstance(context);
        }
            //Initialize LogPersister
        LogPersister.setLogLevel(Logger.getLogLevel());
        LogPersister.setContext(context);

        //Instrument Logger with LogPersisterDelegate
        LogPersisterDelegate logPersisterDelegate = new LogPersisterDelegate();
        Logger.setLogPersister(logPersisterDelegate);

        MFPInAppFeedBackListner.setContext(context);

        Analytics.setAnalyticsDelegate(new BMSAnalyticsDelegate());

        BMSAnalytics.clientApiKey = clientApiKey;

        if(contexts != null){
            for(Analytics.DeviceEvent event : contexts){
                switch(event){
                    case LIFECYCLE:
                        MFPActivityLifeCycleCallbackListener.init(app);
                        break;
                    case NETWORK:
                        isRecordingNetworkEvents = true;
                        break;
                    case ALL:
                        MFPActivityLifeCycleCallbackListener.init(app);
                        isRecordingNetworkEvents = true;
                        break;
                    case NONE:
                        break;
                }
            }
        }

         //if (!hasUserContext) {
         //    Use device ID as default user ID:

         //}

	    if (collectLocation) {
            BMSAnalytics.collectLocation = collectLocation;
            locationService.init();
        }

        DEFAULT_USER_ID = getDeviceID(context);
        if(!collectLocation)
        {
            setUserIdentity(DEFAULT_USER_ID,true);
        }

        BMSAnalytics.hasUserContext = hasUserContext;
        appName = applicationName;

        //Intercept requests to add device metadata header
        BaseRequest.registerInterceptor(new MetadataHeaderInterceptor(context.getApplicationContext()));
        BaseRequest.registerInterceptor(new NetworkLoggingInterceptor());

        enable();

        MFPInAppFeedBackListner.sendAppFeedback();
    }
static public void init ( Application app , String applicationName , String clientApiKey , boolean hasUserContext , boolean collectLocation , Analytics . DeviceEvent ... contexts ) { Context context = app . getApplicationContext ( ) ; if ( collectLocation ) { locationService = MFPAnalyticsLocationListener . getInstance ( context ) ; } //Initialize LogPersister LogPersister . setLogLevel ( Logger . getLogLevel ( ) ) ; LogPersister . setContext ( context ) ; //Instrument Logger with LogPersisterDelegate LogPersisterDelegate logPersisterDelegate = new LogPersisterDelegate ( ) ; Logger . setLogPersister ( logPersisterDelegate ) ; MFPInAppFeedBackListner . setContext ( context ) ; Analytics . setAnalyticsDelegate ( new BMSAnalyticsDelegate ( ) ) ; BMSAnalytics . clientApiKey = clientApiKey ; if ( contexts != null ) { for ( Analytics . DeviceEvent event : contexts ) { switch ( event ) { case LIFECYCLE : MFPActivityLifeCycleCallbackListener . init ( app ) ; break ; case NETWORK : isRecordingNetworkEvents = true ; break ; case ALL : MFPActivityLifeCycleCallbackListener . init ( app ) ; isRecordingNetworkEvents = true ; break ; case NONE : break ; } } } //if (!hasUserContext) { //    Use device ID as default user ID: //} if ( collectLocation ) { BMSAnalytics . collectLocation = collectLocation ; locationService . init ( ) ; } DEFAULT_USER_ID = getDeviceID ( context ) ; if ( ! collectLocation ) { setUserIdentity ( DEFAULT_USER_ID , true ) ; } BMSAnalytics . hasUserContext = hasUserContext ; appName = applicationName ; //Intercept requests to add device metadata header BaseRequest . registerInterceptor ( new MetadataHeaderInterceptor ( context . getApplicationContext ( ) ) ) ; BaseRequest . registerInterceptor ( new NetworkLoggingInterceptor ( ) ) ; enable ( ) ; MFPInAppFeedBackListner . sendAppFeedback ( ) ; }
Initialize BMSAnalytics API.
This must be called before any other BMSAnalytics.* methods

@param app Android Application to instrument with MFPAnalytics.
@param applicationName Application's common name.  Should be consistent across platforms.
@param clientApiKey The Client API Key used to communicate with your MFPAnalytics service.
@param hasUserContext If false, Analytics only records one user per device. If true, setting the user identity will keep a record of all users.
@param collectLocation If true, Analytics will begin to record location metadeta
@param contexts One or more context attributes MFPAnalytics will register event listeners for.
Initialize BMSAnalytics API . This must be called before any other BMSAnalytics . * methods