Integrating twitter sdk with android app in android studio?

痴心易碎 提交于 2019-12-16 18:02:18

问题


I want to share posts on twitter from my android application, For this i need to integrate the twitter sdk with my android application in android studio. The examples that i am getting is for integrating twitter in eclipse.

Can any bodyhelp as how to integrate twitter sdk in android studio?


回答1:


There's a plugin for android studio to integrate twitter that is Fabric.

Step 1- Go to dev.twitter.com

Step 2- Download FabricAndroidStudioPlugin.

Step 3- After downloading, follow this link to add this plugin in android studio.

To add this plugin in android studio

Go to File ->> Settings ->> Click on Plugins -->> then click on Install plugin from disk button -->> then select that FabricAndroidStudioPlugin zip file and ok..!! An icon of fabric will be there on toolbar. Then click that icon and follow the steps. fabric will now do everything automatically.




回答2:


It helps me for Twitter integration in android application.

This is offical Twitter Kit for Android(Twitter SDK)

check this link https://dev.twitter.com/twitterkit/android/installation

dependencies {
// Include all the Twitter APIs
compile 'com.twitter.sdk.android:twitter:3.0.0'
// (Optional) Monetize using mopub
compile 'com.twitter.sdk.android:twitter-mopub:3.0.0'
}

repositories {
 jcenter()
}

public class CustomApplication {
public void onCreate() {
TwitterConfig config = new TwitterConfig.Builder(this)
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(new TwitterAuthConfig("CONSUMER_KEY", "CONSUMER_SECRET"))
.debug(true)
.build();
Twitter.initialize(config);
}
}


来源:https://stackoverflow.com/questions/29529932/integrating-twitter-sdk-with-android-app-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!