Dinesh Kanivu
Dinesh Kanivu

Reputation: 2587

Windows Phone Facebook Integration

Guys i am doing Windows Phonefacebook integration.

enter image description here

In that image i showed two image. here i am getting login look like first image. I want my facebook login look like Second image.

private void Button_Click(object sender, RoutedEventArgs e)
        {
            //Client Parameters
            var parameters = new Dictionary<string, object>();
            parameters["client_id"] = FBApi;
            parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html";
            parameters["response_type"] = "token";
            parameters["display"] = "touch";
            //The scope is what give us the access to the users data, in this case
            //we just want to publish on his wall
            parameters["scope"] = "publish_stream";
            Browser.Visibility = System.Windows.Visibility.Visible;
            Browser.Navigate(client.GetLoginUrl(parameters));
            //Browser.Source = new Uri("htpp://m.facebook.com/mobile");
            //Browser.Navigate(new Uri("url name", UriKind.Absolute));
         }



        // Browser navigating and accessing the facebook Token==========================================================>

        private void BrowserNavitaged(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            FacebookOAuthResult oauthResult;
            //Making sure that the url actually has the access token
            if (!client.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))
            {
                return;
            }
            //Checking that the user successfully accepted our app, otherwise just show the error
            if (oauthResult.IsSuccess)
            {
                //Process result
                client.AccessToken = oauthResult.AccessToken;
                //Hide the browser
                //Browser.Visibility = System.Windows.Visibility.Collapsed;
                //PostToWall();     // Post wall to Facebook.
                CameraStarting(); // start the Camera.
            }
            else
            {
                //Process Error
                MessageBox.Show(oauthResult.ErrorDescription);
                Browser.Visibility = System.Windows.Visibility.Collapsed;
            }
        }

Upvotes: 1

Views: 1706

Answers (1)

Sahil Mittal
Sahil Mittal

Reputation: 20753

Your login looks like the first image since you've open the facebook in the web browser control.

This is not really a better way to integrate facebook. Instead use the facebook sdk for windows phone. Details here: http://facebooksdk.net/docs/phone/tutorial/

Another thing, this will still open the browser for login if the facebook app is not installed in the phone. The second image corresponds to the facebook app.

Upvotes: 3

Related Questions