Java Code Examples for com.google.firebase.analytics.FirebaseAnalytics#getInstance()
The following examples show how to use
com.google.firebase.analytics.FirebaseAnalytics#getInstance() .
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: VideoActivity.java From evercam-android with GNU Affero General Public License v3.0 | 6 votes |
private void readShortcutCameraId() { Intent liveViewIntent = this.getIntent(); if (liveViewIntent != null && liveViewIntent.getExtras() != null) { //Calling firebase analytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); Bundle bundle = new Bundle(); bundle.putString("Evercam_Shortcut_Used", "Use shortcut from Home"); mFirebaseAnalytics.logEvent("Home_Shortcut", bundle); try { if (evercamCamera != null) { getMixpanel().sendEvent(R.string.mixpanel_event_use_shortcut, new JSONObject().put("Camera ID", evercamCamera.getCameraId())); } } catch (JSONException e) { e.printStackTrace(); } liveViewCameraId = liveViewIntent.getExtras().getString(HomeShortcut.KEY_CAMERA_ID, ""); } }
Example 2
Source File: AnalyticsTest.java From gdx-fireapp with Apache License 2.0 | 6 votes |
@Test public void setScreen() { // Given Analytics analytics = new Analytics(); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { ((Runnable) invocation.getArgument(0)).run(); return null; } }).when(((AndroidApplication) Gdx.app)).runOnUiThread(Mockito.any(Runnable.class)); // When analytics.setScreen("test", AnalyticsTest.class); // Then PowerMockito.verifyStatic(FirebaseAnalytics.class, VerificationModeFactory.times(1)); FirebaseAnalytics.getInstance((Context) Gdx.app); Mockito.verify(firebaseAnalytics, VerificationModeFactory.times(1)) .setCurrentScreen(Mockito.eq((Activity) Gdx.app), Mockito.eq("test"), Mockito.eq(AnalyticsTest.class.getSimpleName())); Mockito.verifyNoMoreInteractions(firebaseAnalytics); }
Example 3
Source File: VideoActivity.java From evercam-android with GNU Affero General Public License v3.0 | 6 votes |
public void onFirstJpgLoaded() { showProgressView(false); startTimeCounter(); //Calling firebase analytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(VideoActivity.this); Bundle bundle = new Bundle(); bundle.putString("JPG_Stream_Played", "Successfully played JPG stream"); mFirebaseAnalytics.logEvent("JPG_Streaming", bundle); StreamFeedbackItem successItem = new StreamFeedbackItem (VideoActivity.this, AppData.defaultUser.getUsername (), true); successItem.setCameraId(evercamCamera.getCameraId()); successItem.setType(StreamFeedbackItem.TYPE_JPG); }
Example 4
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 5
Source File: FirebaseAnalyticsWrapper.java From GitJourney with Apache License 2.0 | 5 votes |
public FirebaseAnalyticsWrapper(Context context) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); boolean fbanalytics = sharedPref.getBoolean("fbanalytics_switch", true); if (fbanalytics) { firebaseAnalytics = FirebaseAnalytics.getInstance(context); } }
Example 6
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 7
Source File: SignUpActivity.java From evercam-android with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onPostExecute(String message) { if (message == null) { //Calling firebase analytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(SignUpActivity.this); Bundle bundle = new Bundle(); bundle.putString("Evercam_User_Name", newUser.getUsername()); bundle.putString("Evercam_Email", newUser.getEmail()); mFirebaseAnalytics.logEvent("Signed_Up", bundle); /* //Calling google analytics EvercamPlayApplication.sendEventAnalytics(SignUpActivity.this, R.string.category_sign_up, R.string.action_signup_success, R.string.label_signup_successful); */ getMixpanel().identifyNewUser(newUser); getMixpanel().identifyUser(newUser.getUsername()); getMixpanel().sendEvent(R.string.mixpanel_event_sign_up, null); registerUserWithIntercom(newUser); new EvercamAccount(SignUpActivity.this).add(newUser); AppData.defaultUser = newUser; showProgress(false); setResult(Constants.RESULT_TRUE); finish(); } else { showProgress(false); CustomToast.showInCenter(SignUpActivity.this, message); } }
Example 8
Source File: HomeFragment.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
@Override public void onResume() { super.onResume(); FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(getContext()); analytics.setCurrentScreen(getActivity(), getClass().getSimpleName(), "Home Screen"); }
Example 9
Source File: WebFragment.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
@Override public void onResume() { super.onResume(); Bundle params = new Bundle(); FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(getContext()); analytics.setCurrentScreen(getActivity(), getClass().getSimpleName(), "Web View Screen"); params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen"); params.putString(FirebaseAnalytics.Param.ITEM_NAME, "MainActivity"); // mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params); }
Example 10
Source File: LoginActivity.java From cannonball-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); setUpViews(); mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); }
Example 11
Source File: AnalyticsTest.java From gdx-fireapp with Apache License 2.0 | 5 votes |
@Test public void setUserId() { // Given Analytics analytics = new Analytics(); // When analytics.setUserId("test"); // Then PowerMockito.verifyStatic(FirebaseAnalytics.class, VerificationModeFactory.times(1)); FirebaseAnalytics.getInstance((Context) Gdx.app); Mockito.verify(firebaseAnalytics, VerificationModeFactory.times(1)) .setUserId(Mockito.eq("test")); Mockito.verifyNoMoreInteractions(firebaseAnalytics); }
Example 12
Source File: FirestackAnalytics.java From react-native-firestack with MIT License | 5 votes |
public FirestackAnalyticsModule(ReactApplicationContext reactContext) { super(reactContext); this.context = reactContext; mReactContext = reactContext; Log.d(TAG, "New instance"); mFirebaseAnalytics = FirebaseAnalytics.getInstance(this.context); }
Example 13
Source File: AnalyticsImpl.java From island with Apache License 2.0 | 5 votes |
private AnalyticsImpl(final Context context) { final GoogleAnalytics google_analytics = GoogleAnalytics.getInstance(context); if (BuildConfig.DEBUG) google_analytics.setDryRun(true); mGoogleAnalytics = google_analytics.newTracker(R.xml.analytics_tracker); mGoogleAnalytics.enableAdvertisingIdCollection(true); mFirebaseAnalytics = FirebaseAnalytics.getInstance(FirebaseWrapper.init()); // TODO: De-dup the user identity between Mainland and Island. }
Example 14
Source File: BaseActivity.java From StatusSaver-for-Whatsapp with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); }
Example 15
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); }
Example 16
Source File: BaseActivity.java From utexas-utilities with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getSupportActionBar(); mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); }
Example 17
Source File: MainActivity.java From Birdays with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_main); ButterKnife.bind(this); FirebaseAnalytics.getInstance(this); preferences = PreferenceManager.getDefaultSharedPreferences(this); Utils.setupDayNightTheme(preferences); dbHelper = new DbHelper(this); pagerAdapter = new PagerAdapter(getSupportFragmentManager(), this); setSupportActionBar(toolbar); viewPager.setAdapter(pagerAdapter); viewPager.setOffscreenPageLimit(2); tabLayout.setupWithViewPager(viewPager); if (!preferences.getBoolean(Constants.CONTACTS_UPLOADED, false)) { new ContactsHelper(this, getContentResolver()).loadContacts(preferences); } searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { pagerAdapter.search(newText); return false; } }); if (preferences.getBoolean(getString(R.string.ad_banner_key), true)) { Ad.showBannerAd(container, adView, fab); } // Start page viewPager.setCurrentItem(Integer.parseInt(preferences.getString(Constants.START_PAGE, "1"))); }
Example 18
Source File: LbryAnalytics.java From lbry-android with MIT License | 4 votes |
public static void init(Context context) { analytics = FirebaseAnalytics.getInstance(context); }
Example 19
Source File: FirebaseReporting.java From eternity with Apache License 2.0 | 4 votes |
@Inject FirebaseReporting(Application application) { this.analytics = FirebaseAnalytics.getInstance(application); }
Example 20
Source File: EventStatistics.java From rebootmenu with GNU General Public License v3.0 | 2 votes |
/** * 初始化统计组件 * * @param context {@link Context} */ public static void initComponent(Context context) { if (MainCompat.shouldLoadCSC()) analytics = FirebaseAnalytics.getInstance(context); }