Code Monkey home page Code Monkey logo

analytics-android-integration-firebase's Introduction

analytics-android-integration-firebase

Maven Central Javadocs

Firebase Analytics integration for analytics-android.

Installation

To install the Segment-Firebase integration, simply add this line to your gradle file:

implementation 'com.segment.analytics.android.integrations:firebase:+@aar'

Note: The Firebase SDK requires Android resources. To avoid issues with app crashes please implement using the aar package.

Note

To use firebase-integrations 1.4.+ :

  • Update your app to use (AndroidX) or Android 29
  • Upgrade com.android.tools.build:gradle to v3.2.1 or later

For Android 28 or Lower: here

Don't forget to add the following dependencies to make sure Firebase works:

apply plugin: 'com.android.application'

android {
  // ...
}

// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services'  // Google Play services Gradle plugin

Usage

After adding the dependency, you must register the integration with our SDK. To do this, import the Firebase integration:

import com.segment.analytics.android.integrations.firebase.FirebaseIntegration;

And add the following line:

analytics = new Analytics.Builder(this, "write_key")
                .use(FirebaseIntegration.FACTORY)
                .build();

Please see our documentation for more information.

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

The MIT License (MIT)

Copyright (c) 2014 Segment, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

analytics-android-integration-firebase's People

Contributors

brennan avatar briemcnally avatar carlosmecha avatar niallzato avatar prayansh avatar wenxi-zeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

analytics-android-integration-firebase's Issues

EventName transformation with makeKey not proper.

Hi,

I have an event named Onboarding: Goal Selected. This is accepted in segment and I wanted to integrate firebase destination with segment but the transformation made in firebase integration does not take into account ":" or other special characters. So I get the following error,

Name must consist of letters, digits or _ (underscores). Type, name: event, Onboarding:_Goal_Selected.

App crash: TransactionTooLargeException

In my app, it’s easy to crash in device [LG G3, Android 5.0.1]. Once occur, it will keep crash in any screen.

Follow is crash stack:


java.lang.RuntimeException: Package manager has died
	at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:311)
	at com.b.a.a.a.a.a.onActivityResumed(FirebaseIntegration.java:117)
	at com.b.a.i$8.a(IntegrationOperation.java:73)
	at com.b.a.a.b(Analytics.java:1311)
	at com.b.a.a$7$1.run(Analytics.java:389)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5299)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: android.os.TransactionTooLargeException
	at android.os.BinderProxy.transactNative(Native Method)
	at android.os.BinderProxy.transact(Binder.java:496)
	at android.content.pm.IPackageManager$Stub$Proxy.getActivityInfo(IPackageManager.java:1992)
	at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:306)
	... 12 more

After adding v2.3.3 to build gradle its crashing with Error inflating class androidx.drawerlayout.widget.DrawerLayout

Crashing on the run as the Analytics instance is called on Application class. After commenting out the dependency it works fine. Otherwise throws the following log:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.HomeActivity}: android.view.InflateException: Binary XML file line #3 in com.myapp:layout/activity_home: Binary XML file line #3 in com.myapp:layout/activity_home: Error inflating class androidx.drawerlayout.widget.DrawerLayout
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)
                                                                                                    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
                                                                                                    	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)

Caused by: java.lang.NoSuchFieldError: No static field drawerLayoutStyle of type I in class Landroidx/drawerlayout/R$attr; or its superclasses (declaration of 'androidx.drawerlayout.R$attr' appears in /data/data/com.myapp/code_cache/.overlay/base.apk/classes.dex)
                                                                                                    	at androidx.drawerlayout.widget.DrawerLayout.<init>(DrawerLayout.java:332)

Getting Firebase Analytics errors after upgrading to 2.3.0 library version

Hey!
We've started to see a lot of the errors after upgrading to 2.3.0 version.
E/FA: Item cannot contain custom parameters: view_item_list, Bundle[{item_name=TEST PRODUCT, labels=[Discount], image_url="test image url", regular_price=100.0, brand_id=1234, _err=23, price=35.00, sizes_available=7, currency=EUR, position=9, item_id=2323}]

Why is it happening?
Do you have a migration guide to the latest library version?

Android 28 or lower support

We are adding the Segment Firebase integration but it's crashing for devices on Android 28 or lower (our min SDK is 26).

I see there is a vague mention in the README file about this and it points to a link without much explanation to use the version 1.2.0.
Is using 1.2.0 the only way of making the integration work on Android 28 and lower?
What do we do with higher versions, do they get stuck forever in 1.2.0?

Android Gradle Plugin v3.5.0 causes runtime Fatal Exception

When I use segment analytics firebase integration with Android Gradle Plugin v3.5.0, I get a runtime crash every time accessing a gms error code string.

Firebase seems to work by itself.

java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f150009
Full error log here

My workaround for this is to downgrade to android gradle plugin 3.4.1

SDK v2.3.1 - Still getting NullPointerException on products iterator

I upgraded my SDK to version 2.3.1 because of this fix.

However after releasing a new version of my app I still see the NullPointerException on products.
Here is the full stack trace.

Fatal Exception: java.lang.NullPointerException
Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference

com.segment.analytics.android.integrations.firebase.FirebaseIntegration.formatProducts (FirebaseIntegration.java:227)
com.segment.analytics.android.integrations.firebase.FirebaseIntegration.formatProperties (FirebaseIntegration.java:216)
com.segment.analytics.android.integrations.firebase.FirebaseIntegration.track (FirebaseIntegration.java:186)
com.segment.analytics.IntegrationOperation$10.run (IntegrationOperation.java:205)
com.segment.analytics.Analytics.performRun (Analytics.java:1464)
com.segment.analytics.Analytics$10.run (Analytics.java:825)

Is this still an issue or is there something else I have to do besides upgrading?

com.segment.analytics.android.integrations.firebase.FirebaseIntegration.makeKey(FirebaseIntegration.java:192) error

Hi,
I am getting following error from a segment class when I run the app. But, this is happening only one of the developers' laptop. Do you know what it is related to?

Thank you!

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference
at com.segment.analytics.android.integrations.firebase.FirebaseIntegration.makeKey(FirebaseIntegration.java:192)
at com.segment.analytics.android.integrations.firebase.FirebaseIntegration.formatProperties(FirebaseIntegration.java:172)
at com.segment.analytics.android.integrations.firebase.FirebaseIntegration.track(FirebaseIntegration.java:155)
at com.segment.analytics.IntegrationOperation$10.run(IntegrationOperation.java:176)
at com.segment.analytics.Analytics.performRun(Analytics.java:1464)
at com.segment.analytics.Analytics$10.run(Analytics.java:825)

error: cannot access zzeuq

Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.

Mixpanel alias issue

I track events and send them to Mixpanel (before sign up/log in). After sign up/login I am calling alias(newId) and identify(newId). Works fine! But after user logs out (gets new anonymous id, as I am calling reset() ) and logs in, those tracked events (between log out and log in) are recorded as separate user actions (orphaned), but after logging in the events are recorded correctly. How can I solve this?

Firebase events

I am wondering why firebase is sometimes not working (or working but not on real-time view). I am sending events, but when I look at firebase stream view, there is no data. Even after an hour (or half). But, sometimes I notice there (on firebase) are events have been recorded. Is it an issue? Or It takes so much time for you to send and for firebase to recieve the data?

Segment makeKey doesn't replace dash from params and events name

From Segment documentation

Firebase has strict requirements for User Property names; they must:
Begin with a letter (not a number or symbol, including an underscore)
Contain only alphanumeric characters and underscores
Be no longer than 40 characters
User Property values must be fewer than 100 characters.

The issue is we are not mapping the dash symbol to something else. This prevent Firebase to log any element with a dash symbol in it.

I have open PR about that #28

Reset Firebase client when Segment is reset

I was looking through the implementation of this integration and noticed that it does not override Integration.reset().

Would it make sense to reset the Firebase client in this method? I was thinking either by calling FirebaseAnalytics.resetAnalyticsData() or simply setting the user ID to null with FirebaseAnalytics.setUserId(null). This way, the user can be cleared when they log out by calling Segment's Analytics.with(context).reset()

@Override
public void reset() {
  super.reset();

  firebaseAnalytics.resetAnalyticsData();
  OR
  firebaseAnalytics.setUserId(null);

  logger.verbose("firebaseAnalytics.reset();");
}

See:

Loading dependency stopped working

Today i've noticed that loading dependency stopped working. I have it defined in my project as:
implementation 'com.segment.analytics.android.integrations:firebase:+@aar'.

Until today it work properly, however right now I'm getting the error:

> Unable to load Maven meta-data from https://jcenter.bintray.com/com/segment/analytics/android/integrations/firebase/maven-metadata.xml.
 > Could not HEAD 'https://jcenter.bintray.com/com/segment/analytics/android/integrations/firebase/maven-metadata.xml'.
  > Read timed out

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.