New Facebook API 3.0. and ActionBarSherlock compatibility

后端 未结 2 1547
南旧
南旧 2021-02-05 12:00

I\'m reading facebook Android API 3.0 documents, and I do not understand what does session has to do with background activities. In all examples I\'m supposed to extend \"Facebo

2条回答
  •  渐次进展
    2021-02-05 13:01

    FacebookFragment is not public and is not intended for use by applications.

    The samples do mostly use FacebookActivity though, and yes--you do not need to extend FacebookActivity. As you mention, SessionLoginSample demonstrates this, and if you are not using FacebookActivity you should handle Session serialization and override/forward onActivityResult as illustrated there.

    That said, it sounds like the main issue you are hitting is around setting the applicationId. You can set applicationId in code or in meta-data.

    In code:

    To set it in code, define a String constant MY_APP_ID that contains your app id and replace the line:

    session = new Session(this);
    

    with:

    session = new Session.Builder(this).setApplicationId(MY_APP_ID).build();
    

    In metadata:

    To set it in meta-data, add the following to your AndroidManifest.xml inside the application tag but outside of any activity tags:

    
    

    Then, in values/strings.xml, add a value for app_id that has your app id:

    1234567890
    

提交回复
热议问题