当前位置: 首页>>代码示例>>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;未经允许,请勿转载。