@Override public void postPhoto( Activity parent, Share share, String comment, Uri photoUri, SocialNetworkListener listener) { PropagationInfoResponse propagationInfoResponse = share.getPropagationInfoResponse(); PropagationInfo propInfo = propagationInfoResponse.getPropagationInfo(ShareType.FACEBOOK); if (propInfo != null) { String link = propInfo.getAppUrl(); String appId = getSocialize().getConfig().getProperty(SocializeConfig.FACEBOOK_APP_ID); if (!StringUtils.isEmpty(appId)) { postPhoto(parent, appId, link, comment, photoUri, listener); } else { String msg = "Cannot post message to Facebook. No app id found. Make sure you specify facebook.app.id in socialize.properties"; onError(parent, msg, new SocializeException(msg), listener); } } else { String msg = "Cannot post message to Facebook. No propagation info found"; onError(parent, msg, new SocializeException(msg), listener); } }
/* * (non-Javadoc) * @see com.socialize.networks.AbstractSocialNetworkSharer#doShare(android.app.Activity, com.socialize.entity.Entity, com.socialize.entity.PropagationUrlSet, java.lang.String, com.socialize.networks.SocialNetworkListener, com.socialize.api.action.ActionType) */ @Override protected void doShare( Activity context, Entity entity, PropagationInfo urlSet, String comment, SocialNetworkListener listener, ActionType type) { Tweet tweet = new Tweet(); switch (type) { case SHARE: if (StringUtils.isEmpty(comment)) comment = "Shared " + entity.getDisplayName(); break; case LIKE: comment = "\u2764 likes " + entity.getDisplayName(); break; case VIEW: comment = "Viewed " + entity.getDisplayName(); break; } StringBuilder status = new StringBuilder(); if (StringUtils.isEmpty(comment)) { status.append(entity.getDisplayName()); } else { status.append(comment); } status.append(", "); status.append(urlSet.getEntityUrl()); tweet.setText(status.toString()); UserSettings settings = UserUtils.getUserSettings(context); if (settings != null && settings.isLocationEnabled()) { tweet.setLocation(LocationUtils.getLastKnownLocation(context)); tweet.setShareLocation(true); } TwitterUtils.tweet(context, tweet, listener); }
@Override public void post( Activity parent, Entity entity, String message, PropagationInfo propInfo, SocialNetworkListener listener) { String caption = "Download the app now to join the conversation."; String linkName = appUtils.getAppName(); String link = propInfo.getAppUrl(); String appId = getSocialize().getConfig().getProperty(SocializeConfig.FACEBOOK_APP_ID); if (!StringUtils.isEmpty(appId)) { post(parent, appId, linkName, message, link, caption, listener); } else { String msg = "Cannot post message to Facebook. No app id found. Make sure you specify facebook.app.id in socialize.properties"; onError(parent, msg, new SocializeException(msg), listener); } }