Example usage for twitter4j Twitter reportSpam

List of usage examples for twitter4j Twitter reportSpam

Introduction

In this page you can find the example usage for twitter4j Twitter reportSpam.

Prototype

User reportSpam(long userId) throws TwitterException;

Source Link

Document

The user specified in the id is blocked by the authenticated user and reported as a spammer.

Usage

From source file:com.javielinux.utils.UserActions.java

License:Apache License

public static void goToReportSpam(Context context, InfoUsers infoUsers) {
    ConnectionManager.getInstance().open(context);
    Twitter twitter = ConnectionManager.getInstance()
            .getTwitter(DBUtils.getIdFromUserName(infoUsers.getName()));
    try {/*  ww  w  .j  a  va  2s .c  o m*/
        twitter.reportSpam(infoUsers.getName());
        Utils.showMessage(context, context.getString(R.string.user_report_spam));
    } catch (TwitterException e) {
        e.printStackTrace();
    }
}

From source file:twitter4j.examples.spamreporting.ReportSpam.java

License:Apache License

/**
 * Usage: java twitter4j.examples.spamreporting.ReportSpam [screen name]
 *
 * @param args String[]//from w w w. j  a v  a2s .  c  om
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("java twitter4j.examples.spamreporting.ReportSpam [screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        System.out.println(
                "Successfully reported @" + twitter.reportSpam(args[0]).getScreenName() + " as a spammer.");
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to report spam: " + te.getMessage());
        System.exit(-1);
    }
}