I am not able to post twitter card to twitter application?I am not able to find error?

android
cards

#1

Here is code:

  @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
        Fabric.with(this, new Twitter(authConfig));
        Fabric.with(this, new TwitterCore(authConfig), new TweetUi());
        Fabric.with(this, new TwitterCore(authConfig), new TweetComposer(), new Crashlytics());
        setContentView(R.layout.activity_main);
        rl1=(RelativeLayout)findViewById(R.id.rl1);
        textView = (TextView) findViewById(R.id.tv_username);
        loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
        loginButton.setCallback(new Callback<TwitterSession>() {

            @Override
            public void success(Result<TwitterSession> result) {
                session = result.data;
                String username = session.getUserName();
                userid = session.getUserId();
                final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
                final Card card = new Card.AppCardBuilder(MainActivityextend.this)
                        .imageUri(Uri.parse("https://media.glassdoor.com/sqll/7344/actuate-squarelogo-1389294193237.png"))
                        .googlePlayId("com.medzone.twitterpic")
                        .build();
                final Intent intent = new ComposerActivity.Builder(MainActivityextend.this)
                        .session(session)
                        .card(card)
                        .createIntent();
                startActivity(intent);
            }
            @Override
            public void failure(TwitterException exception) {
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        loginButton.onActivityResult(requestCode, resultCode, data);

#2

Can you provide any more detail here - what is the issue, error, or unexpected behaviour you are seeing with this code?


#3

There is no error in the application.Twitter card is easily created but when i clicked on tweet button then it will not sending post to twitter.


#4

Hey @Nati078626,

Has your package name been approved to post cards to Twitter?

-Mike


#5

Yes approved but still getting error

Unexpected response: {"request":"\/1.1\/statuses\/update.json","error":"Read-only application cannot POST."}
                                                                   java.lang.NullPointerException: Attempt to get length of null array
                                                                       at com.twitter.sdk.android.core.Callback.failure(Callback.java:45)
                                                                       at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
                                                                       at android.os.Handler.handleCallback(Handler.java:810)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                       at android.os.Looper.loop(Looper.java:189)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5530)
                                                                       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:950)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
09-06 11:06:08.138 11838-11838/com.votesocracy.twitter2 E/TweetUploadService: Post Tweet failed
                                                                              com.twitter.sdk.android.core.TwitterApiException: 401 Authorization Required
                                                                                  at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
                                                                                  at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
                                                                                  at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
                                                                                  at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                  at java.lang.Thread.run(Thread.java:818)
09-06 11:06:52.895 11838-11838/com.votesocracy.twitter2 E/TweetFailureReceiver: Intent { cmp=com.votesocracy.twitter2/com.twitter.sdk.android.tweetcomposer.TweetUploadService (has extras) }

#6

That sounds weird, it looks like your application does not have read/write permissions on Twitter. Was your application key created via Fabric, or are you pasting it in from apps.twitter.com?


#8

I changed my acess token key and secret key,Now everything is working fine twitter card is created easily but when i clicked the tweet button it just only post the text not the twitter card and i am not finding any error ?What is the issue.


#9

I’m not familiar with the way that this is intended to work in the TweetComposer in Fabric, but when the Tweet is posted, does the card appear? With regular cards on the web, the card does not appear in the web intent composer, just in the final rendered Tweet.


#10

I am sending twitter card from my android application.When i create twitter card its working fine created successfully,but when I clicked tweet button,Just text is posted but twitter card is not showing in android application nor in the web.


#11

Help me Please Andypiper?


#12

Hmm, the previous logs and post seem to indicate that something very odd is happening. Can you please email into support(at)fabric(dot)io, reference this thread and provide your Twitter Consumer Key?


#13

I am sharing you github link(https://github.com/actimobiledev/Twittersud) where you could find whole source code of application.Through this you can check the exact issue?


#14

It looks like your app’s key doesn’t have the correct permissions. Given that the keys are now public, they need to be revoked and re-created. Your Twitter Consumer Key and Fabric API key should not be made public.

If you head to your Fabric dashboard, you generate a new key there for Twitter Kit. After you do that, please email into support(at)fabric(dot)io, reference this thread and I can check to make sure you have the needed permissions.