List of usage examples for twitter4j StatusUpdate displayCoordinates
boolean displayCoordinates
To view the source code for twitter4j StatusUpdate displayCoordinates.
Click Source Link
From source file:de.hoesel.dav.buv.twitter.baustelle.BaustelleTwitternDialog.java
License:Open Source License
@Override protected void okPressed() { RahmenwerkService service = RahmenwerkService.getService(); Twitter twitter = service.getTwitter(); try {// w w w . ja v a 2s .c om // TODO:Bilder funktionieren noch nicht richtig // InputStream resourceAsStream = // BaustelleTwitternDialog.class.getResourceAsStream("baustelle.gif"); StatusUpdate update = new StatusUpdate("[Test] " + messgae.getText()); if (location != null) { // TODO: Das funktioniert nur, wenn man in seinen Twitter // Setting via Opt-In das Anzeigen der Location erlaubt. update.displayCoordinates(true); update.setLocation(location); } // update.setMedia("Baustelle",resourceAsStream); twitter.updateStatus(update); super.okPressed(); } catch (TwitterException e) { setErrorMessage(e.getLocalizedMessage()); e.printStackTrace(); } }
From source file:org.springframework.integration.twitter.StatusUpdateSupport.java
License:Apache License
/** * {@link StatusUpdate} instances are used to drive status updates. * * @param message the inbound messages//from w w w . j a v a 2s.co m * @return a {@link StatusUpdate} that's been materialized from the inbound message * @throws Throwable thrown if something goes wrong */ public StatusUpdate fromMessage(Message<?> message) throws Throwable { Object payload = message.getPayload(); StatusUpdate statusUpdate = null; if (payload instanceof String) { statusUpdate = new StatusUpdate((String) payload); if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID)) { Long replyId = (Long) message.getHeaders().get(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID); if ((replyId != null) && (replyId > 0)) { statusUpdate.inReplyToStatusId(replyId); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_PLACE_ID)) { String placeId = (String) message.getHeaders().get(TwitterHeaders.TWITTER_PLACE_ID); if (StringUtils.hasText(placeId)) { statusUpdate.placeId(placeId); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_GEOLOCATION)) { GeoLocation geoLocation = (GeoLocation) message.getHeaders() .get(TwitterHeaders.TWITTER_GEOLOCATION); if (null != geoLocation) { statusUpdate.location(geoLocation); } } if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_DISPLAY_COORDINATES)) { Boolean displayCoords = (Boolean) message.getHeaders() .get(TwitterHeaders.TWITTER_DISPLAY_COORDINATES); if (displayCoords != null) { statusUpdate.displayCoordinates(displayCoords); } } } if (payload instanceof StatusUpdate) { statusUpdate = (StatusUpdate) payload; } return statusUpdate; }