From 71929d221dd3066a87a21098a893be5ad6434577 Mon Sep 17 00:00:00 2001 From: Kovartthan Date: Thu, 9 Nov 2017 12:16:41 +0530 Subject: [PATCH] Create README.md --- README.md | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..be191a7 --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# Twitter VPlay +## Twitter Video Share Without using the composer . + +This is the extension of the Twitter4j library . This library used to share the video along with the text silently that means without using the composer. + +**IMPORTANT NOTE : Please download the above project and run it , if u have any doubt in souce refer MainActivity.class in the app folder and refer gradle too avoid unnecessary error** + +## SETUP + +**NOTE : Before you add this dependency , please add Twitter sdk to your project ...** + +###### First : Add the dependency to the gradle +``` +compile 'com.ko.twitter.vplay.core:twittervideoshare:1.0.1' +``` +or maven + +``` + + com.ko.twitter.vplay.core + twittervideoshare + 1.0.1 + pom + + +``` + +That 's all u have added the library successfully to your project . + +###### Second : How to do twitter video share silently + +**Please add strict mode in the onCreate() to avoid network exception while doing twitter video share** + +``` +if (android.os.Build.VERSION.SDK_INT > 16) { + StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); + StrictMode.setThreadPolicy(policy); +} + +``` + +**Install Mutli dex support to your project** + +``` + @Override + public void attachBaseContext(Context base) { + MultiDex.install(base); + super.attachBaseContext(base); +} + +``` +**After login from the twitter sdk , get the active session from it** + +``` +final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession(); +``` + +**Setup confiuration builder for the twiiter video share** + +``` + private com.ko.twitter.vplay.core.Twitter twitter; + private ConfigurationBuilder configurationBuilder; + private com.ko.twitter.vplay.core.auth.AccessToken accessTokenForTwitter; + + // Set the token and secret from the login user using twitter sdk to the instance for the library + + accessTokenForTwitter = new com.ko.twitter.vplay.core.auth.AccessToken(session.getAuthToken().token, session.getAuthToken().secret); + + configurationBuilder = new ConfigurationBuilder(); + configurationBuilder.setDebugEnabled(true); + configurationBuilder.setUseSSL(true); + configurationBuilder.setOAuthConsumerKey(TWITTER_KEY); + configurationBuilder.setOAuthConsumerSecret(TWITTER_SECRET); + + TwitterFactory twitterFactory = new TwitterFactory(configurationBuilder.build()); + + // Setting that auth token to instance for the twitter4j variable from the library + + twitter = twitterFactory.getInstance(); + twitter.setOAuthAccessToken(accessTokenForTwitter); + +``` + +**Finally send the file to uploadMediaChunked** + +``` + twitter.uploadMediaChunked("video", fileInputStream); +``` + +**NOTE : Do the above syntax in async task , to avoid lag in your UI Thread** + + + + + + + + + + + +