Search in sources :

Example 1 with PostingTweetEvent

use of com.path.android.jobqueue.examples.twitter.events.PostingTweetEvent in project android-priority-jobqueue by path.

the class PostTweetJob method onAdded.

@Override
public void onAdded() {
    //job has been secured to disk, add item to database
    try {
        Tweet tweet = new Tweet(localId, null, text, TwitterController.getInstance().getUserId(), null, new Date(System.currentTimeMillis()));
        TweetModel.getInstance().insertOrReplace(tweet);
        EventBus.getDefault().post(new PostingTweetEvent(tweet));
    } catch (TwitterException exception) {
    //if we cannot get user id, we won't add it locally for now.
    }
}
Also used : Tweet(com.path.android.jobqueue.examples.twitter.entities.Tweet) TwitterException(twitter4j.TwitterException) Date(java.util.Date) PostingTweetEvent(com.path.android.jobqueue.examples.twitter.events.PostingTweetEvent)

Aggregations

Tweet (com.path.android.jobqueue.examples.twitter.entities.Tweet)1 PostingTweetEvent (com.path.android.jobqueue.examples.twitter.events.PostingTweetEvent)1 Date (java.util.Date)1 TwitterException (twitter4j.TwitterException)1