Java Code Examples for com.google.firebase.analytics.FirebaseAnalytics#logEvent()
The following examples show how to use
com.google.firebase.analytics.FirebaseAnalytics#logEvent() .
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: AnalyticsReceiver.java From HeartbeatFixerForGCM with Apache License 2.0 | 6 votes |
@Override public void onReceive(Context context, Intent intent) { if (intent == null) { return; } final FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(context.getApplicationContext()); final String action = intent.getAction(); Advertisement advertisement = intent.getParcelableExtra("ad"); Bundle bundle = new Bundle(); bundle.putInt("version", advertisement.version); if (ACTION_CLICK.equals(action)) { analytics.logEvent("push_ad_click", bundle); final Intent intent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(advertisement.landingPageUrl)); intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent1); } else if (ACTION_DELETE.equals(action)) { analytics.logEvent("push_ad_delete", bundle); } }
Example 2
Source File: DebugHelper.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public static void checkEmptyLastSyncedBlock(String s, Context context) { if (s.equalsIgnoreCase("")) { try { FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context); Bundle params = new Bundle(); params.putString("device", "brand: " + Build.BRAND + " device: " + Build.DEVICE + " model: " + Build.MODEL); params.putString("time",String.valueOf(System.currentTimeMillis())); params.putString("full_text", "sharedManager.getLastSyncedBlock() is empty"); firebaseAnalytics.logEvent("lastBlockEmpty", params); } catch (Exception e) { Log.e("psd", "Firebase - sharedManager.getLastSyncedBlock()"); } } }
Example 3
Source File: DebugHelper.java From guarda-android-wallets with GNU General Public License v3.0 | 5 votes |
public static void logIventFirebase(String name, String trace, Context c) { try { FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(c); Bundle params = new Bundle(); params.putString("stacktrace", trace); firebaseAnalytics.logEvent(name, params); } catch (Exception e) { Log.e("psd", "Firebase - DebugHelper"); } }
Example 4
Source File: ReadingActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
private void logOpenBookAnalytics(int bookId, String bookName) { try { FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); if (mFirebaseAnalytics != null) { Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ITEM_ID, String.valueOf(bookId)); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, bookName); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); } } catch (Exception e) { Timber.e(e); } }
Example 5
Source File: KcaUtils.java From kcanotify with GNU General Public License v3.0 | 5 votes |
public static void sendUserAnalytics(Context context, String event, JsonObject value) { Bundle params = new Bundle(); FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(context); if (value != null) { for (String key: value.keySet()) { params.putString(key, value.get(key).getAsString()); } } mFirebaseAnalytics.logEvent(event, params); }
Example 6
Source File: FirebaseAnalyticsUtil.java From commcare-android with Apache License 2.0 | 5 votes |
private static void reportEvent(String eventName, Bundle params) { if (analyticsDisabled() || versionIncompatible()) { return; } FirebaseAnalytics analyticsInstance = CommCareApplication.instance().getAnalyticsInstance(); setUserProperties(analyticsInstance); analyticsInstance.logEvent(eventName, params); }
Example 7
Source File: MainActivity.java From OneTapVideoDownload with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectLeakedSqlLiteObjects() .penaltyLog() .build() ); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(ViewPagerFragmentParent.FRAGMENT_TAG) == null) { FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.content_frame, new ViewPagerFragmentParent(), ViewPagerFragmentParent.FRAGMENT_TAG); ft.commit(); fm.executePendingTransactions(); } FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this); Bundle bundle = new Bundle(); bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Activity~" + getClass().getName()); firebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_OPEN, bundle); if (CheckPreferences.xposedErrorsEnabled(this)) { checkXposedInstallation(); } mApplicationUpdateNotification = new ApplicationUpdateNotification(this); mApplicationUpdateNotification.checkForUpdate(); onNewIntent(getIntent()); if (Global.isPlaystoreAvailable(this)) { FirebaseMessaging.getInstance().subscribeToTopic("playstore_users_notifications");; } else { FirebaseMessaging.getInstance().subscribeToTopic("non_playstore_users_notifications"); } ThemeManager.applyTheme(this); }