페이스 북을 설치하고 모든 것이 잘 작동하는 Wrapper를 시도했습니다. SSO가 SSO를 실행 한 다음 사용자 정의 대화 상자를 통해 게시하고 모든 것이 정상적으로 작동합니다.simpleface SSO fallback은 anythin을하지 않을 것입니다.
그렇다면 페이스 북 앱을 설치하지 않은 상태에서도 동일한 작업을하고 싶었지만 로그인 대화 상자가 나타나지 않았다면 아무 일도 일어나지 않았습니다.
기본적으로 이것은 코드입니다. 나는 기본적으로 샘플의 코드를 따라, 그래서 코드의 대부분은 "익숙한"이어야합니다 :
조각 필드 :
private SimpleFacebook mSimpleFacebook;
private OnLoginListener mOnLoginListener = new OnLoginListener()
{
@Override
public void onThinking()
{
// TODO Auto-generated method stub
toast("Thinking");
}
@Override
public void onException(Throwable throwable)
{
toast("Exception: " + throwable.getMessage());
Log.e(TAG, "Bad thing happened", throwable);
}
@Override
public void onFail(String reason)
{
toast(reason);
}
@Override
public void onLogin()
{
publishFeed();
}
@Override
public void onNotAcceptingPermissions(Type type)
{
toast("Permission not accepted");
}
};
private ProgressDialog mProgress;
조각에서 onCreate :
Permission[] permissions = new Permission[]
{
Permission.USER_PHOTOS,
Permission.EMAIL,
Permission.PUBLISH_ACTION
};
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId(AppConstants.FB_APPID)
.setNamespace(AppConstants.FB_APP_NAMESPACE)
.setPermissions(permissions)
.build();
SimpleFacebook.setConfiguration(configuration);
조각 onResume 샘플에서와 같이 조각보기
는버튼 :
mSimpleFacebook.login(mOnLoginListener);
publishFeed. Utils의 Last static 함수는 Feed와 AlertDialog를 생성합니다.
private void publishFeed()
{
// listener for publishing action
OnPublishListener onPublishListener = new OnPublishListener()
{
@Override
public void onFail(String reason)
{
hideDialog();
// insure that you are logged in before publishing
Log.w(TAG, "Failed to publish");
// toast("Failed to publish");
}
@Override
public void onException(Throwable throwable)
{
hideDialog();
Log.e(TAG, "Bad thing happened", throwable);
// toast("Bad thing happened");
}
@Override
public void onThinking()
{
// show progress bar or something to the user while publishing
showDialog();
}
@Override
public void onComplete(String postId)
{
hideDialog();
ActionType type = ActionType.FBPOST;
if(MQData.getInstance().checkEventConstraint(mEvent, getActivity().getApplicationContext()))
{
type = ActionType.FBPOSTEVENT;
}
Points.addPoints(type, mEvent.getEvent_id(), getActivity().getApplicationContext());
mActivity.onActionBarChanged(false);
}
};
// feed builder
// Feed feed = new Feed.Builder()
// .setMessage("Clone it out...")
// .setName("Simple Facebook SDK for Android")
// .setCaption("Code less, do the same.")
// .setDescription("The Simple Facebook library project makes the life much easier by coding less code for being able to login, publish feeds and open graph stories, invite friends and more.")
// .setPicture("https://raw.github.com/sromku/android-simple-facebook/master/Refs/android_facebook_sdk_logo.png")
// .setLink("https://github.com/sromku/android-simple-facebook")
// .addAction("Like us on Facebook", "https://www.facebook.com/MuseumsQuartierWien")
// .build();
//
// mSimpleFacebook.publish(feed, true, onPublishListener);
Utils.createFBPostBuilder(mEvent, getActivity(), mSimpleFacebook, onPublishListener).create().show();
}
잘못된 것이 있습니까? 내 Facebook 앱에서 특별한 설정을해야합니까, 아니면 안드로이드 코드에서 오류가 있습니까? 내 문제에 대한 해결책을 발견
루카스