-1

I am currently on video 10 (http://marakana.com/s/post/1046/threading_android_demo) of the android tutorials and I am struggling to get the status update to work.

When I use the JTwitter-yamba library provided I get a 301 exception saying " 301 (Moved Permanently)"

It is actually able to post the status, but crashes soon after that.

From this stackoverflow it seems like using an updated JTwitter library should fix it: Authorization error with jTwitter for android

When I use the newest JTwitter library (2.8.8) I get the following error: "HTTP\1.1 Bad Request"

I also get:

[06-23 00:05:13.244: E/AndroidRuntime(3329): {"error":"Client must provide a 'status' parameter with a value.","request":"/api/statuses/update.json"} http://yamba.marakana.com/api/statuses/update.json ]

I am unsure what to do..

Any help appreciated.

Fouad.

The StatusActivity.java code I am using:

    package com.example.yamba;

import winterwell.jtwitter.Twitter;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

public class StatusActivity extends Activity {

    EditText editStatus;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.status); //

        editStatus = (EditText) findViewById(R.id.edit_status);

    }

    public void onClick(View v) {
        final String statusText = editStatus.getText().toString();

        new Thread() {
            @Override
            public void run() {
                Twitter twitter = new Twitter("student", "password");
                twitter.setAPIRootUrl("http://yamba.marakana.com/api"); // redirecting
                twitter.setStatus(statusText);

                Log.d("StatusActivity", statusText);
            }
        }.start();
        Log.d("StatusActivity", "Reached this point");

    }
}

The logcat error I get:

06-23 15:20:46.898: W/dalvikvm(28815): threadid=11: thread exiting with uncaught exception (group=0x41b91540)
06-23 15:20:46.898: E/AndroidRuntime(28815): FATAL EXCEPTION: Thread-8268
06-23 15:20:46.898: E/AndroidRuntime(28815): winterwell.jtwitter.TwitterException: 400 Bad Request
06-23 15:20:46.898: E/AndroidRuntime(28815): HTTP/1.1 400 Bad Request
06-23 15:20:46.898: E/AndroidRuntime(28815): {"error":"Too many duplicate messages too quickly; take a breather and post again in a few minutes.","request":"\/api\/statuses\/update.json"} http://yamba.marakana.com/api/statuses/update.json
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.URLConnectionHttpClient.processError(URLConnectionHttpClient.java:517)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.URLConnectionHttpClient.post2_connect(URLConnectionHttpClient.java:412)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.URLConnectionHttpClient.post2(URLConnectionHttpClient.java:378)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.URLConnectionHttpClient.post(URLConnectionHttpClient.java:347)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2762)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2694)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at winterwell.jtwitter.Twitter.setStatus(Twitter.java:2482)
06-23 15:20:46.898: E/AndroidRuntime(28815):    at com.example.yamba.StatusActivity$1.run(StatusActivity.java:31)
Community
  • 1
  • 1
fouadalnoor
  • 197
  • 2
  • 5
  • 14

2 Answers2

0

{"error":"Too many duplicate messages too quickly; take a breather and post again in a few minutes.","request":"/api/statuses/update.json"}

This is pretty self explanatory. You are posting the same message over and over again. This is used to prevent spammers misusing the API.

Ahmad
  • 69,608
  • 17
  • 111
  • 137
  • 1
    Haha, yeah I dont know why I didnt see that error! I must have been too tired to notice yesterday and only saw the errors prior to that :) – fouadalnoor Jun 23 '13 at 14:27
0

Actually, I think I found out why it didnt work before. It blocks me when I try to post too many status updates in one go! I am guessing JTwitter does not like it when you post too much because it thinks you may be abusing the system?

fouadalnoor
  • 197
  • 2
  • 5
  • 14