當前位置: 首頁>>代碼示例>>Java>>正文


Java FirebaseAnalytics類代碼示例

本文整理匯總了Java中com.google.firebase.analytics.FirebaseAnalytics的典型用法代碼示例。如果您正苦於以下問題:Java FirebaseAnalytics類的具體用法?Java FirebaseAnalytics怎麽用?Java FirebaseAnalytics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FirebaseAnalytics類屬於com.google.firebase.analytics包,在下文中一共展示了FirebaseAnalytics類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onClick

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
public void onClick(View v) {

// Get order details.
int orderId = Integer.parseInt(mTxtbxOrderNumber.getText().toString());
double orderAmount = Double.parseDouble(mTxtbxOrderAmount.getText().toString());
String orderCurrency = mTxtbxCurrency.getText().toString();

// Create event details bundle.
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.TRANSACTION_ID, orderId);
bundle.putDouble(FirebaseAnalytics.Param.VALUE, orderAmount);
bundle.putString(FirebaseAnalytics.Param.CURRENCY, orderCurrency);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ECOMMERCE_PURCHASE, bundle);

Toast.makeText(getApplicationContext(),
        String.format(Locale.US,
                getString(R.string.order_details_format),
                orderId, orderAmount, orderCurrency),
        Toast.LENGTH_SHORT)
        .show();
}
 
開發者ID:googlesamples,項目名稱:android-instant-apps,代碼行數:23,代碼來源:MainActivity.java

示例2: eventLogin

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
public static void eventLogin(Context context,boolean success){
    //Fabric
    Answers.getInstance().logSignUp(new SignUpEvent()
            .putMethod("Normal")
            .putSuccess(success));

    //Firebase
    Bundle params = new Bundle();
    params.putBoolean("Success",success);
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_LOGIN,params);

    //Amplitude
    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_LOGIN,new JSONObject().put("Success",success));
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }

}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:20,代碼來源:AnalyticsManager.java

示例3: eventCalculate

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
public static void eventCalculate(Context context,Course course, double grade){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_CALCULATION)
            .putCustomAttribute("Course name", course.getName())
            .putCustomAttribute("Course code", course.getCode())
            .putCustomAttribute("Result", grade));

    //Firebase
    Bundle params = new Bundle();
    params.putString("course_name",course.getName());
    params.putString("course_code",course.getCode());
    params.putDouble("result",grade);
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_CALCULATION,params);

    //Amplitude
    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_CALCULATION, new JSONObject()
                .put("Course name",course.getName())
                .put("Course code",course.getCode())
                .put("Result",grade));
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }

}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:26,代碼來源:AnalyticsManager.java

示例4: onCreate

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    mContext = getApplicationContext();
    mPlayBackStarter = new PlayBackStarter(mContext);

    // Obtain the FirebaseAnalytics instance.
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    initImageLoader();

    AnalyticsTrackers.initialize(this);
    AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);

    /**
     *disable UIL Logs
     */
    L.writeDebugLogs(false);
}
 
開發者ID:reyanshmishra,項目名稱:Rey-MusicPlayer,代碼行數:20,代碼來源:Common.java

示例5: logMenuItemToFirebase

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
void logMenuItemToFirebase(@NonNull MenuItem item) {
  if (firebaseEnabled) {

    final Intent intent = item.getIntent();

    if (intent == null) {
      Log.i(TAG, "logMenuItemToFirebase: Invalid menu item. Intent must be supplied!");
      return;
    }

    final FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);

    final Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, intent.getStringExtra(Kolibri.EXTRA_ID));

    if (intent.hasExtra(Intent.EXTRA_TITLE)) {
      bundle.putString(FirebaseAnalytics.Param.ITEM_NAME,
          intent.getStringExtra(Intent.EXTRA_TITLE));
    }

    bundle
        .putString(FirebaseAnalytics.Param.CONTENT_TYPE, intent.getStringExtra(Kolibri.EXTRA_ID));
    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
  }
}
 
開發者ID:azmedien,項目名稱:kolibri-android,代碼行數:26,代碼來源:KolibriApp.java

示例6: reportToFirebase

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
public void reportToFirebase(@Nullable String name, @NonNull String url) {
  if (firebaseEnabled) {

    final FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);

    final Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, url);

    if (name != null) {
      bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
      bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, name);
    } else {
      bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "application/amp+html");
    }

    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
  }
}
 
開發者ID:azmedien,項目名稱:kolibri-android,代碼行數:19,代碼來源:KolibriApp.java

示例7: onCreate

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mAnalytics = FirebaseAnalytics.getInstance(this);

    Intent i = new Intent(SplashActivity.this, WelcomeActivity.class);
            startActivity(i);

            finish();
}
 
開發者ID:mangoblogger,項目名稱:MangoBloggerAndroidApp,代碼行數:12,代碼來源:SplashActivity.java

示例8: getTextFromAnotherApp

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Nullable
private String getTextFromAnotherApp() {
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if (type.equals("text/plain")) {
            String text = intent.getStringExtra(Intent.EXTRA_TEXT);
            FirebaseAnalytics.getInstance(this).logEvent("open_from_another_app", new Bundle());
            return text;
        }
    }
    return null;
}
 
開發者ID:tranleduy2000,項目名稱:text_converter,代碼行數:16,代碼來源:MainActivity.java

示例9: onViewCreated

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ImageView wallpaper = view.findViewById(R.id.img_wallpaper);
    ImageView icon = view.findViewById(R.id.img_icon);
    final ApplicationItem applicationItem = (ApplicationItem) getArguments().getSerializable(KEY_APP_ITEM);
    Glide.with(getContext()).load(applicationItem.getIconUrl()).apply(new RequestOptions().centerCrop()).into(icon);
    Glide.with(getContext()).load(applicationItem.getWallpaperUrl()).apply(new RequestOptions().centerCrop()).into(wallpaper);

    TextView txtName = view.findViewById(R.id.txt_name);
    txtName.setText(applicationItem.getName());

    view.findViewById(R.id.root_view).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String applicationId = applicationItem.getApplicationId();
            FirebaseAnalytics.getInstance(getActivity()).logEvent(applicationId, new Bundle());
            StoreUtil.gotoPlayStore(getActivity(), applicationId);
        }
    });
}
 
開發者ID:tranleduy2000,項目名稱:text_converter,代碼行數:22,代碼來源:ApplicationFragment.java

示例10: onCreate

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());

    Prefs.initPrefs(this);

    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }

    FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(this);

    _myComponent = DaggerMyComponent.builder()
            .myModule(new MyModule(this, analytics))
            .build();

}
 
開發者ID:StephanBezoen,項目名稱:tumblrlikes,代碼行數:19,代碼來源:LikesApplication.java

示例11: References

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
private References(Context context, FirebaseDatabase database) {
    this.context = context;
    this.database = database;

    user = new User();
    chat = new Chat();

    usersRef = database.getReference(Constant.USER);
    contactsRef = database.getReference(Constant.CONTACTS);
    chatsRef = database.getReference(Constant.CHAT);
    messagesRef = database.getReference(Constant.MESSAGES);
    rafflesRef = database.getReference(Constant.RAFFLES);
    prizesRef = database.getReference(Constant.PRIZES);
    holdersRef = database.getReference(Constant.Holders);
    newsRef = database.getReference(Constant.NEWS);
    versionRef = database.getReference(Constant.VERSION);
    phonesRef = database.getReference(Constant.PHONES);
    contactListRef = database.getReference(Constant.CONTACT_LIST);
    analytics = FirebaseAnalytics.getInstance(context);
}
 
開發者ID:AppHero2,項目名稱:Raffler-Android,代碼行數:21,代碼來源:References.java

示例12: beginShift

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
/**
     * Updates user node with appropriate shift-start data
     */
    private void beginShift(){
        Intent authenticationHandoff = new Intent(this, ShiftStartActivity.class);

        //Update user object in database as logged in
        FirebaseUser user = mAuth.getCurrentUser();

        String loginSuccess = "User " + user.getUid() + " has signed in.";
        Bundle params = new Bundle();
        params.putString("time_stamp", "");

        //TODO 12/5/17 KB can be removed
//                            Log.d(TAG, "signInWithEmail:success");
//
//                            Log.d(TAG, "instanceid: " + FirebaseInstanceId.getInstance().getToken());

        mAnalyticsInstance.logEvent(FirebaseAnalytics.Event.LOGIN, params);
        //TODO 12/5/17 KB can be removed
        //get or add employee in database
        //createEmployee(email);
        startActivity(authenticationHandoff);
    }
 
開發者ID:panzerama,項目名稱:Dispatch,代碼行數:25,代碼來源:LoginActivity.java

示例13: doInBackground

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
protected Boolean doInBackground(Void... voids) {
    FirebaseApp.initializeApp(mContext);
    MobileAds.initialize(mContext.getApplicationContext(), mContext.getResources().getString(R.string.app_id));
    FirebaseAnalytics.getInstance(mContext).setAnalyticsCollectionEnabled(true);
    FirebaseAnalytics.getInstance(mContext).setMinimumSessionDuration(2000);
    //dc.getGenres(null, null);

    AppVersionTracking current = new AppVersionTracking(BuildConfig.VERSION_CODE, BuildConfig.VERSION_NAME);

    if(!getAppPrefs().checkState()){
        getAppPrefs().saveOrUpdateVersionNumber(current);
        return false;
    }
    AppVersionTracking saved = getAppPrefs().getSavedVersions();
    if((BuildConfig.VERSION_CODE > saved.getCode())) {
        getAppPrefs().saveOrUpdateVersionNumber(current);
        return true;
    }
    return null;
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:22,代碼來源:MainPresenter.java

示例14: onCreate

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    preferences = new Preferences(getApplicationContext());
    gdaxApi = new GdaxApi(getApplicationContext());
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    try {
        BuyScheduler.setAlarm(getApplicationContext());
    } catch (Exception exc) {
    }

    if (preferences.arePreferencesValid()) {
        getFragmentManager().beginTransaction()
                .replace(android.R.id.content, new DashboardFragment())
                .commit();
    } else {
        getFragmentManager().beginTransaction()
                .replace(android.R.id.content, new ConfigureMeFragment())
                .commit();
    }
}
 
開發者ID:aomega08,項目名稱:Keep-HODLing,代碼行數:24,代碼來源:MainActivity.java

示例15: eventLogout

import com.google.firebase.analytics.FirebaseAnalytics; //導入依賴的package包/類
public static void eventLogout(Context context){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_LOGOUT));

    //Firebase
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_LOGOUT,new Bundle());

    //Amplitude
    Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_LOGOUT);
}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:11,代碼來源:AnalyticsManager.java


注:本文中的com.google.firebase.analytics.FirebaseAnalytics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。