简体   繁体   中英

Fabric Twitter/Fabric Crashlytics- How to add multiple Kits

Here is the ticket for how to aggregate data into a single dashboard: Fabric Crashlytics - Aggregate data from different projects

We use Fabric.with(new Fabric.Builder().kits(new Crashlytics(), ...).appIdentifier("parent app identifier").build()) to make data flow into one dashbaord;

My question is how to add another Fabric Twitter Kit. Fabric.with(Context context, Kit... kits) only takes Kit as parameter, but the return type of "new Fabric.Builder().kits(new Crashlytics(), ...).appIdentifier("parent app identifier").build()" is a Fabric. Any helps? Thanks.

To add twitter with your crashlytics kit, you simply have to do this:

TwitterAuthConfig authConfig =  new TwitterAuthConfig("consumerKey", "consumerSecret");
Fabric.with(this, new Crashlytics(),new Twitter(authConfig));

Don't forget to add twitter into your gradle file

compile('com.twitter.sdk.android:twitter:1.11.0@aar') {
        transitive = true;
}

The method Fabric.with() offers two choice to initiate the Fabric. The first is the one on the top. The context + the kits you want to use (a parameter with ... like Kit...kits means you can put kits separated by a coma (,))

The second way is to first create the Fabric.Builder like

Fabric.Builder builder = new Fabric.Builder(this).kits(new Crashlytics(), new Twitter(authConfig)); 

and then put this builder like this:

Fabric.with(builder.build);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM