Reputation: 195
Am developing an application that has the ability to share content on linkedin, facebook and twitter using the socialauth library. It works fine with facebook but it cannot share with twitter and linkedin. I get a warning that "Provider Not Supported" below is the code am using
socialauthadapter.authorize(this, Provider.TWITTER);
......
private final class ResponseListener implements DialogListener {
public void onComplete(Bundle values) {
try {
socialauthadapter
.updateStory(
headtv.getText().toString().trim(),
"Africa Progress Panel",
"Download APP .",
"This year's report calls on African leaders to tackle inequality and demands global community tackle. Let your voice be heard. Download APP",
"http://africaprogresspanel.org",
Global.SERVER_MAIN_URI
+ "uploads/pictures/reports/subtopics/"
+ subtopic_photo,
new MessageListener());
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onBack() {
// TODO Auto-generated method stub
}
@Override
public void onCancel() {
// TODO Auto-generated method stub
}
@Override
public void onError(SocialAuthError arg0) {
// TODO Auto-generated method stub
}
}
// To get status of message after authentication
public class MessageListener implements SocialAuthListener<Integer> {
@Override
public void onError(SocialAuthError arg0) {
// TODO Auto-generated method stub
}
@Override
public void onExecute(String arg0, Integer t) {
Integer status = t;
if (status.intValue() == 200 || status.intValue() == 201 ||status.intValue() == 204)
Toast.makeText(ReportDetails.this, "Message posted",Toast.LENGTH_LONG).show();
}
}
and in the logcat this is what am seeing
Provider Not Supported
how can i go about this
NOTE:
- all key are correct
Upvotes: 1
Views: 994
Reputation: 124
You can try my library for social auth and sharing: https://github.com/antonkrasov/AndroidSocialNetworks
It's really easy to use, just build Fragment with enabling social networks you need:
mSocialNetworkManager = (SocialNetworkManager) getFragmentManager().findFragmentByTag(SOCIAL_NETWORK_TAG);
if (mSocialNetworkManager == null) {
mSocialNetworkManager = SocialNetworkManager.Builder.from(getActivity())
.twitter(<< TWITTER API TOKEN >>, << TWITTER API SECRET >>)
.linkedIn(<< LINKED_IN API TOKEN >>, << LINKED_IN API SECRET >>, "r_basicprofile+rw_nus+r_network+w_messages")
.facebook()
.googlePlus()
.build();
getFragmentManager().beginTransaction().add(mSocialNetworkManager, SOCIAL_NETWORK_TAG).commit();
}
And now you can share:
mSocialNetworkManager.getTwitterSocialNetwork().requestPostMessage(message,
new DemoOnPostingCompleteListener(message)
);
private class DemoOnPostingCompleteListener implements OnPostingCompleteListener {
private String mmMessage;
private DemoOnPostingCompleteListener(String message) {
mmMessage = message;
}
@Override
public void onPostSuccessfully(int socialNetworkID) {
hideProgress();
handleSuccess("Success", "Message: '" + mmMessage + "' successfully posted.");
}
@Override
public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) {
hideProgress();
handleError(errorMessage);
}
}
Please check Github repo for more info, Thanks :)
Upvotes: 1