Can we upload video in Android Without Intent?

restapi
android
twitter4j

#1

If yes , then how?

I’m trying below code block to post video but it’s throwing exception and I used twitter4j-core-4.0.4 library

Error block
400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting(https://dev.twitter.com/pages/rate-limiting). In API v1.1, a request without authentication is considered invalid and you will get this response.
{“request”:"/1.1/media/upload.json",“error”:“media type unrecognized.”}

Code Block

OauthAccessToken accessToken = new OauthAccessToken(getOauthaccess_token(),  getOauthsecret_token());
            OauthConsumer oauthconsumer = new OauthConsumer(getConsumer_key(), getConsumer_secret(), CALLBACK_URL);
           
            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
            configurationBuilder.setOAuthConsumerKey(oauthconsumer.getConsumerKey());
            configurationBuilder.setOAuthConsumerSecret(oauthconsumer.getConsumerSecret());
            configurationBuilder.setOAuthAccessToken(accessToken.getToken());
            configurationBuilder.setOAuthAccessTokenSecret(accessToken.getSecret());
            Configuration configuration = configurationBuilder.build();

            twitter4j.Twitter twitter = new TwitterFactory(configuration).getInstance();
            
           InputStream is = new FileInputStream(new File(filepath));
            twitter.uploadMedia("twitter video",is);