com.facebook.appevents.AppEventsLogger Java Examples
The following examples show how to use
com.facebook.appevents.AppEventsLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FirstLaunchAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
public Completable sendAppStart(android.app.Application application, SharedPreferences sharedPreferences, IdsRepository idsRepository) { FacebookSdk.sdkInitialize(application); AppEventsLogger.activateApp(application); AppEventsLogger.newLogger(application); return idsRepository.getUniqueIdentifier() .doOnSuccess(AppEventsLogger::setUserID) .toObservable() .doOnNext(__ -> setupRakamFirstLaunchSuperProperty( SecurePreferences.isFirstRun(sharedPreferences))) .doOnNext(__ -> sendPlayProtectEvent()) .doOnNext(__ -> setupDimensions(application)) .filter(__ -> SecurePreferences.isFirstRun(sharedPreferences)) .doOnNext( __ -> sendFirstLaunchEvent(utmSource, utmMedium, utmCampaign, utmContent, entryPoint)) .toCompletable() .subscribeOn(Schedulers.io()); }
Example #2
Source File: LoginLogger.java From kognitivo with Apache License 2.0 | 6 votes |
LoginLogger(Context context, String applicationId) { this.applicationId = applicationId; appEventsLogger = AppEventsLogger.newLogger(context, applicationId); // Store which version of facebook is installed try { PackageManager packageManager = context.getPackageManager(); if (packageManager != null) { PackageInfo facebookInfo = packageManager.getPackageInfo(FACEBOOK_PACKAGE_NAME, 0); if (facebookInfo != null) { facebookVersion = facebookInfo.versionName; } } } catch (PackageManager.NameNotFoundException e) { // Do nothing, just ignore and not log } }
Example #3
Source File: MyApp.java From FaceT with Mozilla Public License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); Log.d("Myapp " , " start"); // _instance = this; FirebaseApp.getApps(this); //enable the offline capability for firebase if (!FirebaseApp.getApps(this).isEmpty()) { FirebaseDatabase.getInstance().setPersistenceEnabled(true); } EmojiManager.install(new EmojiOneProvider()); Picasso.Builder builder = new Picasso.Builder(this); // builder.downloader(new OkHttpDownloader(this,Integer.MAX_VALUE)); Picasso built = builder.build(); // built.setIndicatorsEnabled(false); // built.setLoggingEnabled(true); Picasso.setSingletonInstance(built); // Initialize the SDK before executing any other operations, FacebookSdk.sdkInitialize(getApplicationContext()); AppEventsLogger.activateApp(this); }
Example #4
Source File: SplashActivity.java From openshop.io-android with MIT License | 5 votes |
@Override protected void onPause() { super.onPause(); // Logs 'app deactivate' App Event. AppEventsLogger.deactivateApp(this); }
Example #5
Source File: AptoideApplicationAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public void setVersionCodeDimension(String versionCode) { Bundle bundle = new Bundle(); bundle.putString("version code", versionCode); AppEventsLogger.updateUserProperties(bundle, response -> Logger.getInstance() .d("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty("version code", versionCode); }
Example #6
Source File: MoPubAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public void setMoPubAbTestGroup(boolean isControlGroup) { Bundle bundle = new Bundle(); bundle.putString("ASV-1377-MoPub-Ads", isControlGroup ? "a_without_mopub" : "b_with_mopub"); AppEventsLogger.updateUserProperties(bundle, response -> Logger.getInstance() .d("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty("ASV-1377-MoPub-Ads", isControlGroup ? "a_without_mopub" : "b_with_mopub"); }
Example #7
Source File: FirstLaunchAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
/** * Responsible for setting facebook analytics user properties */ private void setUserProperties(String key, String value) { Bundle parameters = new Bundle(); parameters.putString(key, value); AppEventsLogger.updateUserProperties(parameters, response -> logger.logDebug("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty(key, value); }
Example #8
Source File: LoginActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
@Override protected void onResume() { super.onResume(); // Logs 'install' and 'app activate' App Events. AppEventsLogger.activateApp(this); }
Example #9
Source File: Analytics.java From openshop.io-android with MIT License | 5 votes |
/** * Prepare Google analytics trackers and Facebook events logger. * Send UTM campaign if exist. * * @param shop shop with app specific Google Ua or null, if global tracker is enough. * @param context application context. */ public static synchronized void prepareTrackersAndFbLogger(Shop shop, Context context) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG if (shop == null) { deleteAppTrackers(); } else { if (!mTrackers.containsKey(TRACKER_APP) && analytics != null) { if (shop.getGoogleUa() != null && !shop.getGoogleUa().isEmpty()) { Timber.d("Set new app tracker with id: %s", shop.getGoogleUa()); // App tracker determined by shop Tracker appTracker = analytics.newTracker(shop.getGoogleUa()); appTracker.enableAutoActivityTracking(true); appTracker.enableExceptionReporting(false); appTracker.enableAdvertisingIdCollection(true); mTrackers.put(TRACKER_APP, appTracker); } else { Timber.e(new RuntimeException(), "Creating GA app tracker with empty Google UA"); } } else { Timber.e("Trackers for this app already exist."); } } // Add global tracker only one time. if (!mTrackers.containsKey(TRACKER_GLOBAL) && analytics != null) { Timber.d("Set new global tracker."); // Global app tracker Tracker appTrackerGlobal = analytics.newTracker(R.xml.global_tracker); appTrackerGlobal.enableAutoActivityTracking(true); appTrackerGlobal.enableExceptionReporting(true); appTrackerGlobal.enableAdvertisingIdCollection(true); mTrackers.put(TRACKER_GLOBAL, appTrackerGlobal); // Send camping info only once time. sendCampaignInfo(); } facebookLogger = AppEventsLogger.newLogger(MyApplication.getInstance()); }
Example #10
Source File: SplashActivity.java From openshop.io-android with MIT License | 5 votes |
@Override protected void onResume() { super.onResume(); // Logs 'install' and 'app activate' App Events. AppEventsLogger.activateApp(this); }
Example #11
Source File: MoPubAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public void setAdsVisibilityUserProperty( WalletAdsOfferManager.OfferResponseStatus offerResponseStatus) { Bundle bundle = new Bundle(); String ads = mapToAdsVisibility(offerResponseStatus).getType(); bundle.putString(ADS_STATUS_USER_PROPERTY, ads); AppEventsLogger.updateUserProperties(bundle, response -> Logger.getInstance() .d("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty(ADS_STATUS_USER_PROPERTY, ads); String adsStatusByRakamValue = mapAdsVisibilityToRakamValues(offerResponseStatus); Rakam.getInstance() .setSuperProperties(createRakamAdsSuperProperties(adsStatusByRakamValue)); }
Example #12
Source File: MainActivity.java From openshop.io-android with MIT License | 5 votes |
@Override protected void onResume() { super.onResume(); // FB base events logging AppEventsLogger.activateApp(this); // GCM registration LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver, new IntentFilter(SettingsMy.REGISTRATION_COMPLETE)); }
Example #13
Source File: MainActivity.java From openshop.io-android with MIT License | 5 votes |
@Override protected void onPause() { super.onPause(); // FB base events logging AppEventsLogger.deactivateApp(this); MyApplication.getInstance().cancelPendingRequests(CONST.MAIN_ACTIVITY_REQUESTS_TAG); // GCM registration LocalBroadcastManager.getInstance(this).unregisterReceiver(mRegistrationBroadcastReceiver); }
Example #14
Source File: AnalyticsUnitTest.java From openshop.io-android with MIT License | 5 votes |
private void prepareMockedFields() throws Exception { // Mock responses PowerMockito.mockStatic(GoogleAnalytics.class); PowerMockito.mockStatic(AppEventsLogger.class); doReturn(mockAnalytics).when(GoogleAnalytics.class, "getInstance", mockContext); doReturn(mockAppEventsLogger).when(AppEventsLogger.class, "newLogger", anyObject()); when(mockAnalytics.newTracker(R.xml.global_tracker)).thenReturn(mockTracker); when(mockAnalytics.newTracker(testShop.getGoogleUa())).thenReturn(mockTrackerApp); }
Example #15
Source File: AnalyticsUnitTest.java From openshop.io-android with MIT License | 5 votes |
@Test public void prepareGlobalTrackerAndFbLoggerTest() throws Exception { // Mock responses PowerMockito.mockStatic(GoogleAnalytics.class); PowerMockito.mockStatic(AppEventsLogger.class); doReturn(mockAnalytics).when(GoogleAnalytics.class, "getInstance", mockContext); doReturn(mockAppEventsLogger).when(AppEventsLogger.class, "newLogger", anyObject()); when(mockAnalytics.newTracker(R.xml.global_tracker)).thenReturn(mockTracker); // Tested method invocation Analytics.prepareTrackersAndFbLogger(null, mockContext); // Verify results verifyStatic(times(1)); GoogleAnalytics.getInstance(mockContext); verifyStatic(times(1)); Analytics.deleteAppTrackers(); verify(mockAnalytics, times(1)).newTracker(R.xml.global_tracker); verify(mockTracker, times(1)).enableAutoActivityTracking(true); verify(mockTracker, times(1)).enableExceptionReporting(true); verify(mockTracker, times(1)).enableAdvertisingIdCollection(true); verifyNoMoreInteractions(mockTracker); HashMap<String, Tracker> trackersField = Whitebox.getInternalState(Analytics.class, "mTrackers"); assertEquals(trackersField.size(), 1); AppEventsLogger appEventsLoggerField = Whitebox.getInternalState(Analytics.class, "facebookLogger"); assertNotEquals(appEventsLoggerField, null); }
Example #16
Source File: AnalyticsUnitTest.java From openshop.io-android with MIT License | 5 votes |
@Test public void prepareTrackersAndFbLoggerTest() throws Exception { prepareMockedFields(); // Tested method invocation Analytics.prepareTrackersAndFbLogger(testShop, mockContext); // Verify results verifyStatic(times(1)); GoogleAnalytics.getInstance(mockContext); verifyStatic(never()); Analytics.deleteAppTrackers(); verify(mockAnalytics, times(1)).newTracker(testShop.getGoogleUa()); verify(mockAnalytics, times(1)).newTracker(R.xml.global_tracker); verify(mockTrackerApp, times(1)).enableAutoActivityTracking(true); verify(mockTrackerApp, times(1)).enableExceptionReporting(false); verify(mockTrackerApp, times(1)).enableAdvertisingIdCollection(true); verifyNoMoreInteractions(mockTrackerApp); verify(mockTracker, times(1)).enableAutoActivityTracking(true); verify(mockTracker, times(1)).enableExceptionReporting(true); verify(mockTracker, times(1)).enableAdvertisingIdCollection(true); verifyNoMoreInteractions(mockTracker); HashMap<String, Tracker> trackersField = Whitebox.getInternalState(Analytics.class, "mTrackers"); assertEquals(trackersField.size(), 2); AppEventsLogger appEventsLoggerField = Whitebox.getInternalState(Analytics.class, "facebookLogger"); assertNotEquals(appEventsLoggerField, null); }
Example #17
Source File: AndroidGDXFacebook.java From gdx-facebook with Apache License 2.0 | 5 votes |
public AndroidGDXFacebook(final Activity activity, final GDXFacebookConfig config) { super(config); this.activity = activity; FacebookSdk.sdkInitialize(activity.getApplicationContext()); AppEventsLogger.activateApp(activity.getApplication()); callbackManager = CallbackManager.Factory.create(); }
Example #18
Source File: AndroidGDXFacebook.java From gdx-facebook with Apache License 2.0 | 5 votes |
public AndroidGDXFacebook(final AndroidFragmentApplication activity, final GDXFacebookConfig config) { super(config); this.activity = activity.getActivity(); FacebookSdk.sdkInitialize(this.activity.getApplicationContext()); AppEventsLogger.activateApp(this.activity.getApplication()); callbackManager = CallbackManager.Factory.create(); }
Example #19
Source File: AptoideApplicationAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public void updateDimension(boolean isLoggedIn) { Bundle bundle = new Bundle(); bundle.putString("Logged In", isLoggedIn ? "Logged In" : "Not Logged In"); AppEventsLogger.updateUserProperties(bundle, response -> Logger.getInstance() .d("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty("Logged In", isLoggedIn ? "Logged In" : "Not Logged In"); }
Example #20
Source File: ShareInternalUtility.java From kognitivo with Apache License 2.0 | 5 votes |
private static void logShareResult(String shareOutcome, String errorMessage) { Context context = FacebookSdk.getApplicationContext(); AppEventsLogger logger = AppEventsLogger.newLogger(context); Bundle parameters = new Bundle(); parameters.putString( AnalyticsEvents.PARAMETER_SHARE_OUTCOME, shareOutcome ); if (errorMessage != null) { parameters.putString(AnalyticsEvents.PARAMETER_SHARE_ERROR_MESSAGE, errorMessage); } logger.logSdkEvent(AnalyticsEvents.EVENT_SHARE_RESULT, null, parameters); }
Example #21
Source File: LoginMethodHandler.java From kognitivo with Apache License 2.0 | 5 votes |
protected void logWebLoginCompleted(String e2e) { String applicationId = loginClient.getPendingRequest().getApplicationId(); AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(loginClient.getActivity(), applicationId); Bundle parameters = new Bundle(); parameters.putString(AnalyticsEvents.PARAMETER_WEB_LOGIN_E2E, e2e); parameters.putLong( AnalyticsEvents.PARAMETER_WEB_LOGIN_SWITCHBACK_TIME, System.currentTimeMillis()); parameters.putString(AnalyticsEvents.PARAMETER_APP_ID, applicationId); appEventsLogger.logSdkEvent(AnalyticsEvents.EVENT_WEB_LOGIN_COMPLETE, null, parameters); }
Example #22
Source File: DialogPresenter.java From kognitivo with Apache License 2.0 | 5 votes |
public static void logDialogActivity( Context context, String eventName, String outcome) { AppEventsLogger logger = AppEventsLogger.newLogger(context); Bundle parameters = new Bundle(); parameters.putString(AnalyticsEvents.PARAMETER_DIALOG_OUTCOME, outcome); logger.logSdkEvent(eventName, null, parameters); }
Example #23
Source File: BoltsMeasurementEventListener.java From kognitivo with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context); String eventName = BOLTS_MEASUREMENT_EVENT_PREFIX + intent.getStringExtra(MEASUREMENT_EVENT_NAME_KEY); Bundle eventArgs = intent.getBundleExtra(MEASUREMENT_EVENT_ARGS_KEY); Bundle logData = new Bundle(); for(String key : eventArgs.keySet()) { String safeKey = key.replaceAll( "[^0-9a-zA-Z _-]", "-").replaceAll("^[ -]*", "").replaceAll("[ -]*$", ""); logData.putString(safeKey, (String)eventArgs.get(key)); } appEventsLogger.logEvent(eventName, logData); }
Example #24
Source File: LoginActivity.java From Simple-Blog-App with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); FacebookSdk.sdkInitialize(getApplicationContext()); AppEventsLogger.activateApp(this); bindViews(); onClicks(); }
Example #25
Source File: AptoideApplicationAnalytics.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public void setPackageDimension(String packageName) { Bundle bundle = new Bundle(); bundle.putString(APTOIDE_PACKAGE, packageName); AppEventsLogger.updateUserProperties(bundle, response -> Logger.getInstance() .d("Facebook Analytics: ", response.toString())); FlurryAgent.addSessionProperty(APTOIDE_PACKAGE, packageName); }
Example #26
Source File: ApplicationModule.java From aptoide-client-v8 with GNU General Public License v3.0 | 4 votes |
@Singleton @Provides AppEventsLogger provideAppEventsLogger() { return AppEventsLogger.newLogger(application); }
Example #27
Source File: FacebookButtonBase.java From kognitivo with Apache License 2.0 | 4 votes |
private void logButtonTapped(final Context context) { AppEventsLogger logger = AppEventsLogger.newLogger(context); logger.logSdkEvent(analyticsButtonTappedEventName, null, null); }
Example #28
Source File: LikeActionController.java From kognitivo with Apache License 2.0 | 4 votes |
private AppEventsLogger getAppEventsLogger() { if (appEventsLogger == null) { appEventsLogger = AppEventsLogger.newLogger(FacebookSdk.getApplicationContext()); } return appEventsLogger; }
Example #29
Source File: FacebookTrackerTest.java From DarylAndroidTracker with MIT License | 4 votes |
@Before public void setUp() { this.logger = mock(AppEventsLogger.class); this.subject = new FacebookTracker(logger); }
Example #30
Source File: FacebookTracker.java From DarylAndroidTracker with MIT License | 4 votes |
public FacebookTracker(AppEventsLogger logger) { this.logger = logger; }