コード例 #1
0
        public async void StartLogin(
            )
        {
            FBSession s = FBSession.ActiveSession;

            // Assumes the Facebook App ID and Windows Phone Store ID have been
            // saved in the default resource file.
            ResourceLoader rl = ResourceLoader.GetForCurrentView();

            String appId    = rl.GetString(FBAppIDName);
            String winAppId = rl.GetString(FBPhoneAppIDName);


            // IDs are both sent to FB app, so it can validate us.
            s.FBAppId  = appId;
            s.WinAppId = winAppId;

            // These are the default permissions, needed to retrieve user info.
            s.AddPermission("public_profile");
            s.AddPermission("user_friends");
            s.AddPermission("user_likes");

            // Launches a URI to redirect to the FB app, which will log us in
            // and return the result via our registered protocol.
            await s.LoginAndContinue();
        }
コード例 #2
0
        public static void InitializeFBSession()
        {
            FBSession      sess   = FBSession.ActiveSession;
            ResourceLoader loader = ResourceLoader.GetForCurrentView();

            sess.FBAppId = loader.GetString(FBAppIDName);
#if WINDOWS_PHONE_APP
            sess.WinAppId = loader.GetString(FBPhoneAppIDName);
#else
            sess.WinAppId = loader.GetString(FBStoreAppIDName);
#endif
            sess.AddPermission("public_profile");
            sess.AddPermission("user_friends");
            sess.AddPermission("email");
            sess.AddPermission("user_likes");
            sess.AddPermission("user_groups");
        }