Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to pass string from android render page to PCL page ?

$
0
0

Hello

How to pass string value to android render page to PCL page.

show my code

[assembly: ExportRenderer(typeof(LoginPage), typeof(LoginRender))]
namespace TestApp.Droid.Renderers
{
    public class LoginRender : PageRenderer
    {
    protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            // this is a ViewGroup - so should be able to load an AXML file and FindView<>
            var activity = this.Context as Activity;

            var auth = new OAuth2Authenticator(
                clientId: "", // your OAuth2 client id
                scope: "user_about_me", // the scopes for the particular API you're accessing, delimited by "+" symbols
                authorizeUrl: new Uri("https://www.facebook.com/dialog/oauth"), // the auth URL for the service
                redirectUrl: new Uri("https://www.facebook.com/connect/login_success.html")); // the redirect URL for the service

            auth.Completed += (sender, eventArgs) => {
                if (eventArgs.IsAuthenticated)
                {
                    Toast.MakeText(this.Context, eventArgs.Account.Properties["access_token"], ToastLength.Long).Show();

                    App.SuccessfulLoginAction.Invoke();

                    App.SaveToken(eventArgs.Account.Properties["access_token"]);

                }
                else
                {
                    // The user cancelled
                }
            };

            activity.StartActivity(auth.GetUI(activity));
        }
    }
}

I want to send token of eventArgs.Account.Properties["access_token"] to PCL page.

how can i do ?

Please help..


Viewing all articles
Browse latest Browse all 77050

Trending Articles