Twitter sending direct message via Android application

I am trying to send a direct message through an Android application

But I get the following error in LogCat:

java.lang.IllegalStateException: authentication credentials missing. See http://twitter4j.org/configuration.html for more details.

I mentioned http://twitter4j.org/en/code-examples.html

//instance is re-useable and thread safe. Twitter sender = new TwitterFactory().getInstance(); DirectMessage message = sender.sendDirectMessage(recipientId, message); System.out.println("Sent: " message.getText() + " to @" + message.getRecipientScreenName()); 
+4
source share
1 answer

As the error message says:

No authentication credentials.

From Twitter4J's page Code examples :

To run the sample codes, you need to have OAuth credentials configured in twitter4j.properties. See Twitter4J - Configuration for more details.

You must be logged in to send direct messages to Twitter. You need to set up credentials for authentication using one of the three methods listed on the Twitter4J configuration page before the sample code will work.

  • via twitter4j.properties
  • via ConfigurationBuilder
  • through System Properties
+1
source

All Articles