本文整理汇总了Java中com.google.firebase.analytics.FirebaseAnalytics.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java FirebaseAnalytics.getInstance方法的具体用法?Java FirebaseAnalytics.getInstance怎么用?Java FirebaseAnalytics.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.firebase.analytics.FirebaseAnalytics
的用法示例。
在下文中一共展示了FirebaseAnalytics.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: getDefaultFATracker
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public synchronized FirebaseAnalytics getDefaultFATracker() {
if (mFTracker == null) {
mFTracker = FirebaseAnalytics.getInstance(this);
mFTracker.setAnalyticsCollectionEnabled(false);
}
return mFTracker;
}
示例4: onCreate
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_search);
mRecyclerView = (RecyclerView) findViewById(R.id.rv_post_search);
mLayoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mSwipeRefreshLayout = findViewById(R.id.scroll_view_search);
mSwipeRefreshLayout.setColorSchemeResources(
android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
mAdapter = new PostViewAdapter(mListener, "search");
mRecyclerView.setAdapter(mAdapter);
mTAGS = getSelectedTags();
initRefreshListener();
initScrollListener();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_search);
toolbar.setSubtitle(mTAGS);
mSwipeRefreshLayout.setRefreshing(true);
new PullPost(0, mPAGE).execute();
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
new AnalyticsUtils().getAnalytics(TAG, mTAGS, "search" ,mFirebaseAnalytics);
}
示例5: intialize
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public static synchronized void intialize(Context context) {
sAppContext = context;
mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);
setProperty("DeviceType", Utils.getDeviceType(context));
setProperty("Rooted", Boolean.toString(Utils.isRooted()));
}
示例6: send_achievement
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public void send_achievement(final String id) {
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ACHIEVEMENT_ID, id);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(activity);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.UNLOCK_ACHIEVEMENT, bundle);
Utils.d("Sending:AchievementUnlocked: " + id);
}
示例7: onCreate
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mInAppPurchaseHelper = new InAppPurchaseHelper(this);
mInAppPurchaseHelper.onCreate();
}
示例8: send_score
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public void send_score(final String character, final int level, final int score) {
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CHARACTER, character);
bundle.putInt(FirebaseAnalytics.Param.LEVEL, level);
bundle.putInt(FirebaseAnalytics.Param.SCORE, score);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(activity);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.POST_SCORE, bundle);
Utils.d("Sending:Level:Score: {" + character + "|" + level + "|" + score + "}");
}
示例9: send_content
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public void send_content(final String content_type, final String item_id) {
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, content_type);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, item_id);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(activity);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Utils.d("Sending:Content:Item: {" + content_type + "|" + item_id + "}");
}
示例10: spend_currency
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
public void spend_currency(final String item_name, final String currency_name, final int value) {
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, item_name);
bundle.putString(FirebaseAnalytics.Param.VIRTUAL_CURRENCY_NAME, currency_name);
bundle.putInt(FirebaseAnalytics.Param.VALUE, value);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(activity);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SPEND_VIRTUAL_CURRENCY, bundle);
Utils.d(
"Sending:Currency:Spend: {" + item_name + "|" + currency_name + "|" + value + "}");
}
示例11: trackBuy
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
void trackBuy(String crypto, String base) {
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, preferences.getCryptoCurrency());
bundle.putString(FirebaseAnalytics.Param.VALUE, crypto);
Bundle bundle2 = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, preferences.getBaseCurrency());
bundle.putString(FirebaseAnalytics.Param.VALUE, base);
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SPEND_VIRTUAL_CURRENCY, bundle);
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SPEND_VIRTUAL_CURRENCY, bundle2);
}
示例12: onResume
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
FirebaseAnalytics analytics = FirebaseAnalytics.getInstance(getContext());
analytics.setCurrentScreen(getActivity(), getClass().getSimpleName(), "Bookmark Screen");
}
示例13: onCreate
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth);
ButterKnife.bind(this);
firebaseAnalytics=FirebaseAnalytics.getInstance(this);
SharedPreferences sharedPreferences= PreferenceManager.getDefaultSharedPreferences(this);
String jsonToken= sharedPreferences.getString(Constants.EXTRA_TOKEN,null);
if(!TextUtils.isEmpty(jsonToken)){
Bundle bundle=new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,jsonToken);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE,"access token json");
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.LOGIN,bundle);
Token token=BundleUtils.convertFromJsonString(jsonToken,new TypeToken<Token>(){}.getType());
if(token!=null){
welcome(token);
return;
}
}
findViewById(R.id.log_in)
.animate()
.scaleX(1)
.scaleY(1)
.setStartDelay(300)
.setDuration(300)
.start();
}
示例14: onCreate
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
TextView textViewInstant = (TextView) findViewById(R.id.instant_status_text);
String status = "";
// Determine the current app context, either installed or instant, then
// set the corresponding user property for Google Analytics.
if (InstantApps.isInstantApp(this)) {
status = getString(R.string.status_instant);
} else {
status = getString(R.string.status_installed);
}
mFirebaseAnalytics.setUserProperty(getString(R.string.analytics_user_prop),
status);
// Set a TextWatcher to make sure that the user doesn't attempt to
// submit when a EditText is empty.
TextWatcher enableButtonOnTextChanged = setEnableButtonOnTextChange();
mTxtbxOrderNumber = (EditText) findViewById(R.id.txtbx_order_number);
mTxtbxOrderNumber.addTextChangedListener(enableButtonOnTextChanged);
mTxtbxOrderAmount = (EditText) findViewById(R.id.txtbx_order_amount);
mTxtbxOrderAmount.addTextChangedListener(enableButtonOnTextChanged);
mTxtbxCurrency= (EditText) findViewById(R.id.txtbx_currency);
mTxtbxCurrency.addTextChangedListener(enableButtonOnTextChanged);
// Add button click handler to raise e-commerce purchase event.
Button btnSendECommerceEvent = (Button)findViewById(R.id.btn_send_ecommerce_event);
btnSendECommerceEvent.setEnabled(false);
btnSendECommerceEvent.setOnClickListener(mOnClickListener);
textViewInstant.setText(String.format(getString(R.string.lbl_status_text),
status));
}
示例15: onCreate
import com.google.firebase.analytics.FirebaseAnalytics; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
startActivity(new Intent(AuthActivity.this, HomeActivity.class));
} else {
// User is signed out
Log.d(TAG, "onAuthStateChanged:signed_out");
}
}
};
mGoogleSignIn = (SignInButton)findViewById(R.id.google_sign_in);
TextView buttonText = (TextView) mGoogleSignIn.getChildAt(0);
buttonText.setText(R.string.login_google);
mGoogleSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
signIn();
}
});
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext())
.enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Toast.makeText(AuthActivity.this, "Coneccao Falhou",Toast.LENGTH_SHORT).show();
}
})
.addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
.build();
callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) findViewById(R.id.loginButton);
loginButton.setReadPermissions(Arrays.asList("email"));
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
handleFacebookAccessToken(loginResult.getAccessToken());
}
@Override
public void onCancel() {
Toast.makeText(getApplicationContext(), R.string.cancel_login, Toast.LENGTH_SHORT).show();
}
@Override
public void onError(FacebookException error) {
Toast.makeText(getApplicationContext(), R.string.error_login, Toast.LENGTH_SHORT).show();
}
});
}