Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);



            //PackageInfo info = PackageManager.GetPackageInfo();
            //      "Package name",  //Replace your package name here
            //      PackageManager.GET_SIGNATURES);
            //for (Signature signature : info.signatures)
            //{
            //    MessageDigest md = MessageDigest.getInstance("SHA");
            //    md.update(signature.toByteArray());
            //    Log.e("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            //}

            FacebookSdk.SdkInitialize(this.ApplicationContext);
            mprofileTracker = new MyProfileTracker();
            mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged;
            mprofileTracker.StartTracking();
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            BtnFBLogin   = FindViewById <LoginButton>(Resource.Id.fblogin);
            TxtFirstName = FindViewById <TextView>(Resource.Id.TxtFirstname);
            TxtLastName  = FindViewById <TextView>(Resource.Id.TxtLastName);
            TxtName      = FindViewById <TextView>(Resource.Id.TxtName);
            mprofile     = FindViewById <ProfilePictureView>(Resource.Id.ImgPro);

            BtnFBLogin.SetReadPermissions(new List <string> {
                "user_friends", "public_profile"
            });
            mFBCallManager = CallbackManagerFactory.Create();
            BtnFBLogin.RegisterCallback(mFBCallManager, this);
        }
Beispiel #2
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
 {
     try
     {
         FacebookSdk.SdkInitialize(this);
         // FacebookSdk.ApplicationId = "444917649791842"; //pune el id de la app de facebook
         AppEventsLogger.ActivateApp(Application); //no se que hace esta linea
         mprofileTracker = new MyProfileTracker();
         mprofileTracker.mOnProfileChanged += MprofileTracker_mOnProfileChanged;
         mprofileTracker.StartTracking();
         // Set our view from the "main" layout resource
         // SetContentView(Resource.Layout.configCuenta);
         //BtnFBLogin = FindViewById<LoginButton>(Resource.Id.fb_btn);
         BtnFBLogin.SetReadPermissions(new List <string> {
             "public_profile", "user_friends", "email", "user_birthday"
         });
         mFBCallManager = CallbackManagerFactory.Create();
         BtnFBLogin.RegisterCallback(mFBCallManager, this);
         //base.OnActivityResult(requestCode, resultCode, data);
         mFBCallManager.OnActivityResult(requestCode, (int)resultCode, data);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         Console.WriteLine(e); Console.WriteLine(e);
         Console.WriteLine(e); Console.WriteLine(e);
         Console.WriteLine(e); Console.WriteLine(e);
         Console.WriteLine(e); Console.WriteLine(e);
         Console.WriteLine(e);
         Console.WriteLine(e);
     }
 }
Beispiel #3
0
        /**
         * Init Facebook
         */
        public void Init()
        {
            FacebookSdk.SdkInitialize(activity.ApplicationContext);
            FacebookSdk.ApplicationId = activity.Resources.GetString(Resource.String.facebook_app_id);
            callbackManager           = CallbackManagerFactory.Create();
            var loginCallback = new FacebookCallback <LoginResult>
            {
                HandleSuccess = loginResult =>
                {
                    token = loginResult.AccessToken;
                    (Xamarin.Forms.Application.Current as Hauynite).OnLogin(token.UserId);
                    var intent = new Intent(FacebookLoginReceiver.ActionKey);
                    intent.PutExtra(FacebookLoginReceiver.ExtraResult, (int)Result.Success);
                    intent.PutExtra(FacebookLoginReceiver.ExtraUserId, token.UserId);
                    activity.SendBroadcast(intent);
                },
                HandleCancel = () =>
                {
                    var intent = new Intent(FacebookLoginReceiver.ActionKey);
                    intent.PutExtra(FacebookLoginReceiver.ExtraResult, (int)Result.Cancel);
                    activity.SendBroadcast(intent);
                },
                HandleError = loginError =>
                {
                    var intent = new Intent(FacebookLoginReceiver.ActionKey);
                    intent.PutExtra(FacebookLoginReceiver.ExtraResult, (int)Result.Error);
                    activity.SendBroadcast(intent);
                }
            };

            LoginManager.Instance.RegisterCallback(callbackManager, loginCallback);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            FacebookSdk.SdkInitialize(this.ApplicationContext);

            LoadApplication(new App());

            callbackManager = CallbackManagerFactory.Create();

            LoginManager.Instance.RegisterCallback(callbackManager, new FacebookCallback <LoginResult>()
            {
                HandleSuccess = loginResult =>
                {
                    var accessToken = loginResult.AccessToken;
                    App.OnFacebookAuthSuccess(accessToken.Token);
                },
                HandleCancel = () =>
                {
                    App.OnFacebookAuthFailed();
                },
                HandleError = loginError =>
                {
                    App.OnFacebookAuthFailed();
                }
            });
        }
Beispiel #5
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            FacebookSdk.SdkInitialize(this);
            CarouselViewRenderer.Init();
            CrossCurrentActivity.Current.Init(this, bundle);
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            //NEDS for get correct debug keyhash

            PackageInfo info = this.PackageManager.GetPackageInfo("com.impressolabs.Impresso", PackageInfoFlags.Signatures);

            foreach (Android.Content.PM.Signature signature in info.Signatures)
            {
                MessageDigest md = MessageDigest.GetInstance("SHA");
                md.Update(signature.ToByteArray());

                string keyhash = Convert.ToBase64String(md.Digest());
                Console.WriteLine("KeyHash:", keyhash);
            }
        }
        /// <summary>
        /// Ons the create.
        /// </summary>
        /// <param name="savedInstanceState">Saved instance state.</param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            #region [ Facebook ]

            FacebookSdk.SdkInitialize(ApplicationContext);
            callbackManager = CallbackManagerFactory.Create();

            var loginCallback = new FacebookCallback <LoginResult>
            {
                HandleSuccess = loginResult => {
                    var facebookToken = AccessToken.CurrentAccessToken.Token;
                },
                HandleCancel = () => {
                },
                HandleError  = loginError => {
                }
            };

            LoginManager.Instance.RegisterCallback(callbackManager, loginCallback);

            #endregion



            LoadApplication(new App());
        }
Beispiel #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Facebook API initialization
            FacebookSdk.SdkInitialize(this.ApplicationContext);
            AppEventsLogger.ActivateApp(this.Application);

            _masterProfileTracker = new FBProfileTracker();
            _masterProfileTracker.mOnProfileChanged += MasterProfileTracker_mOnProfileChanged;
            _masterProfileTracker.StartTracking();

            // Create your application here
            SetContentView(Resource.Layout.FacebookLoginView);

            _fullNameTextView    = FindViewById <TextView>(Resource.Id.fullNameTextView);
            _facebookLoginButton = FindViewById <LoginButton>(Resource.Id.facebookLoginButton);

            _facebookLoginButton.SetReadPermissions(new List <string> {
                "user_friends",
                "public_profile"
            });
            _masterFBCallManager = CallbackManagerFactory.Create();
            _facebookLoginButton.RegisterCallback(_masterFBCallManager, this);
        }
Beispiel #8
0
        /*Metodo de registro*/
        public void btn_empezar(object sender, EventArgs e)
        {
            //pantalla para logearse
            FacebookSdk.SdkInitialize(this.ApplicationContext);


            SetContentView(Resource.Layout.Main);

            mProfileTracker = new MyProfileTracker();
            mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged;
            mProfileTracker.StartTracking();


            /*Informacion extraida de facebook*/
            mTxtFirstName = FindViewById <TextView>(Resource.Id.txtFirstName);
            mTxtLastName  = FindViewById <TextView>(Resource.Id.txtLastName);
            mTxtName      = FindViewById <TextView>(Resource.Id.txtName);
            mProfilePic   = FindViewById <ProfilePictureView>(Resource.Id.profilePic);

            // LoginButton
            btnFacebook        = FindViewById <LoginButton>(Resource.Id.login_button);
            btnFacebook.Click += botonFB;



            btnRegistrar        = FindViewById <Button>(Resource.Id.btnRegistrar);
            btnRegistrar.Click += btn_registrar;

            btnIniciarSesion        = FindViewById <Button>(Resource.Id.btnIniciarSesion);
            btnIniciarSesion.Click += btn_iniciar_sesion;
        }
Beispiel #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Window.RequestFeature(WindowFeatures.NoTitle);
            Com.Pixate.Freestyle.PixateFreestyle.Init(this);

            FacebookSdk.SdkInitialize(this.ApplicationContext);

            mProfileTracker = new MyProfileTracker();
            mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged;
            mProfileTracker.StartTracking();
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);



            Button btnFacebook = FindViewById <Button>(Resource.Id.btnFacebook);

            mBtnCriar      = FindViewById <Button>(Resource.Id.btnCriarConta);
            mTxtLogarEmail = FindViewById <TextView>(Resource.Id.logarEmail);

            mBtnCriar.Click      += MBtnCriar_Click;
            mTxtLogarEmail.Click += mTxtLogarEmail_Click;


            if (AccessToken.CurrentAccessToken != null)
            {
                //The user is logged in through Facebook
                btnFacebook.Text = "Sair";
            }


            // LoginButton button = FindViewById<LoginButton>(Resource.Id.btnFacebook);
            //  button.SetReadPermissions("user_friends");

            mCallBackManager = CallbackManagerFactory.Create();
            // button.RegisterCallback(mCallBackManager, this);

            LoginManager.Instance.RegisterCallback(mCallBackManager, this);



            btnFacebook.Click += (o, e) =>
            {
                if (AccessToken.CurrentAccessToken != null)
                {
                    //The user is logged in through Facebook
                    LoginManager.Instance.LogOut();
                    btnFacebook.Text = "Logue com Facebook";
                }
                else
                {
                    //The user is not logged in
                    LoginManager.Instance.LogInWithReadPermissions(this, new List <string> {
                        "public_profile", "user_friends"
                    });
                    btnFacebook.Text = "Sair";
                }
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            ////Per ottenere la hash key da inserire in facebook
            //PackageInfo info = this.PackageManager.GetPackageInfo("it.trilogik.AppFocGenova", PackageInfoFlags.Signatures);
            //foreach (Android.Content.PM.Signature signature in info.Signatures)
            //{
            //    MessageDigest md = MessageDigest.GetInstance("SHA");
            //    md.Update(signature.ToByteArray());

            //    string keyhash = Convert.ToBase64String(md.Digest());
            //    Console.WriteLine("KeyHash:", keyhash);
            //}


            FacebookSdk.SdkInitialize(ApplicationContext);
            callbackManager = CallbackManagerFactory.Create();



            LoginManager.Instance.RegisterCallback(callbackManager, new facebookCallBack());
            LoadApplication(new App());
        }
        public override void OnCreate()
        {
            base.OnCreate();
            RegisterActivityLifecycleCallbacks(this);
            FacebookSdk.ApplicationId   = ConstantsHelper.FB_ApplicationID; //"469763806538563";
            FacebookSdk.ApplicationName = ConstantsHelper.AppName;          //"FanWord";
            FacebookSdk.SdkInitialize(this);

            MixpanelAPI mixpanel = MixpanelAPI.GetInstance(this, MIXPANEL_TOKEN);

            CrossPushNotifications.Current.Configure(ServiceApiBase.HubName, ServiceApiBase.AzureConnectionString, new[] { "fanword" }, Resource.Drawable.AppIcon);
            ////due to blank notification the code is commented
            //CrossPushNotifications.Current.PushNotificationClicked += (sender, e) =>
            //{
            //    Navigator.HandleNotificationTap(e.MetaData, e.Title, e.Message);
            //};

            //CrossPushNotifications.Current.PushNotificationRecieved += (sender, item) =>
            //{
            //    var lastId = CrossSettings.Current.GetValueOrDefault("LastNotificationId", "");
            //    if (lastId == item.Id)
            //        return;

            //    CrossSettings.Current.AddOrUpdateValue("LastNotificationId", item.Id);
            //    CrossPushNotifications.Current.ShowLocalNotification(item);
            //};
        }
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     FacebookSdk.SdkInitialize(this.ApplicationContext);
     Forms.Init(this, bundle);
     LoadApplication(new App());
 }
Beispiel #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            //FacebookSDK Config
            FacebookSdk.SdkInitialize(this.ApplicationContext);
            CallbackManager = CallbackManagerFactory.Create();

            //AWS SDK Config
            var loggingConfig = AWSConfigs.LoggingConfig;

            loggingConfig.LogMetrics       = true;
            loggingConfig.LogResponses     = ResponseLoggingOption.Always;
            loggingConfig.LogMetricsFormat = LogMetricsFormatOption.JSON;
            loggingConfig.LogTo            = LoggingOptions.SystemDiagnostics;
            AWSConfigs.AWSRegion           = "eu-west-1";

            //Google Maps Config
            Xamarin.FormsMaps.Init(this, bundle);

            ActionBar.SetIcon(Android.Resource.Color.Transparent);
            LoadApplication(new App());
        }
Beispiel #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            //FacebookSdk.ApplicationId should be set before LoginManager.Instance.LogInWithReadPermissions is called, otherwise
            //the application will crash
            FacebookSdk.ApplicationId   = Constants.FB_APP_ID;
            FacebookSdk.ApplicationName = Constants.FB_APP_NAME;
            FacebookSdk.SdkInitialize(this.ApplicationContext);

            LoadApplication(new App());

            callbackManager = CallbackManagerFactory.Create();

            LoginManager.Instance.RegisterCallback(callbackManager, new FacebookCallback <LoginResult>()
            {
                HandleSuccess = loginResult =>
                {
                    var accessToken = loginResult.AccessToken;
                    App.OnFacebookAuthSuccess(accessToken.Token);
                },
                HandleCancel = () =>
                {
                    App.OnFacebookAuthFailed();
                },
                HandleError = loginError =>
                {
                    App.OnFacebookAuthFailed();
                }
            });
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            //((DroidLoginProvider)DependencyService.Get<ILoginProvider>()).Init(this);

            FacebookSdk.SdkInitialize(ApplicationContext);
            callbackManager = CallbackManagerFactory.Create();


            //var loginCallback = new FacebookCallback<LoginResult>
            //{
            //    HandleSuccess = loginResult => {
            //        var tck =AccessToken.CurrentAccessToken.Token;
            //        //CoffeeCups.Helpers.Settings.FacebookAccessToken = AccessToken.CurrentAccessToken.Token;
            //        App.GoToMainPage();
            //    },
            //    HandleCancel = () => {

            //    },
            //    HandleError = loginError => {

            //    }
            //};



            LoginManager.Instance.RegisterCallback(callbackManager, new facebookCallBack());
            LoadApplication(new App());
        }
        private void InitializedFB()
        {
            activity = this.Context as Activity;
            view     = activity.LayoutInflater.Inflate(Resource.Layout.FacebookLayout, this, false);

            FacebookSdk.SdkInitialize(this.Context);
            NativeFacebookPageRenderer.callbackManager = CallbackManagerFactory.Create();

            #region CHECKING IF ALREADY LOGGED IN TO FACEBOOK
            profile = Profile.CurrentProfile;

            if (profile != null)
            {
                firstname = profile.FirstName;
                lastname  = profile.LastName;
                GetUserInfoViaGraphRequest();
            }

            #endregion

            LoginManager.Instance.RegisterCallback(NativeFacebookPageRenderer.callbackManager, this);
            var buttonFB = view.FindViewById <Button>(Resource.Id.buttonFB);
            buttonFB.Click    += ButtonFB_Click;
            profilePictureView = view.FindViewById <ProfilePictureView>(Resource.Id.profilePicture);

            this.AddView(view);
            NativeView = view;
        }
Beispiel #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Window.RequestFeature(WindowFeatures.NoTitle);

#pragma warning disable CS0618 // Type or member is obsolete
            FacebookSdk.SdkInitialize(this.ApplicationContext);
#pragma warning restore CS0618 // Type or member is obsolete


            SetContentView(Resource.Layout.Main);

            //LoginButton button = FindViewById<LoginButton>(Resource.Id.login_button);

            //button.SetReadPermissions("user_friends");
            mCallBackManager = CallbackManagerFactory.Create();

            //button.RegisterCallback(mCallBackManager, this);

            LoginManager.Instance.RegisterCallback(mCallBackManager, this);

            FindViewById <Button>(Resource.Id.button).Click += (o, e) =>
            {
                LoginManager.Instance.LogInWithReadPermissions(this, new List <string> {
                    "public_profile", "user_friends"
                });
            };
        }
Beispiel #18
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            FacebookSdk.SdkInitialize(this);
            SetContentView(Resource.Layout.Main);

            FindViewById <LoginButton>(Resource.Id.login_button).SetReadPermissions("email");
            callbackManager = CallbackManagerFactory.Create();

            var loginCallback = new FacebookCallback <LoginResult>
            {
                HandleSuccess = SignInWithFacebookToken,
                HandleCancel  = () => Log.Debug(
                    Application.PackageName,
                    "Canceled"),
                HandleError = error => Log.Error(
                    Application.PackageName,
                    Java.Lang.Throwable.FromException(error),
                    "No access")
            };

            LoginManager.Instance.RegisterCallback(callbackManager, loginCallback);

            carService   = new CarService();
            tokenTracker = new FacebookTokenTracker(carService)
            {
                HandleLoggedIn  = UpdateButtons,
                HandleLoggedOut = UpdateButtons
            };

            tokenTracker.StartTracking();

            if (carService.GetLoginStatus() == CarService.LoginStatus.NeedsWebApiToken)
            {
                await SignInWithFacebookToken(AccessToken.CurrentAccessToken.Token);
            }

            UpdateButtons();

            searchCar         = FindViewById <AutoCompleteTextView>(Resource.Id.searchCar);
            findCar           = FindViewById <Button>(Resource.Id.findCar);
            showAvailableCars = FindViewById <Button>(Resource.Id.showAvailableCars);

            findCar.Click         += findCar_Click;
            findCar.Enabled        = false;
            searchCar.TextChanged += (sender, e) =>
            {
                if (searchCar.Text.Length > 4)
                {
                    findCar.Enabled = true;
                }
                else
                {
                    findCar.Enabled = false;
                }
            };

            showAvailableCars.Click += (sender, args) => StartActivity(typeof(allAvailableActivity));
        }
Beispiel #19
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SimpleStorage.SetContext(ApplicationContext);
     SetContentView(Resource.Layout.activity_splash);
     FacebookSdk.SdkInitialize(this.ApplicationContext);
     RunTimer();
 }
Beispiel #20
0
 public void Logout()
 {
     FacebookSdk.SdkInitialize(this);
     LoginManager.Instance.LogOut();
     CrossSettings.Current.Clear();
     StartActivity(typeof(LoginActivity));
     Finish();
 }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     RequestWindowFeature(WindowFeatures.NoTitle);
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.SignUpActivity);
     this.PopulateViewProperties();
     FacebookSdk.SdkInitialize(this);
     SetupViewBindings();
 }
 void IFacebookApiClient.SetFacebookAppID(string appID)
 {
     FacebookSdk.ApplicationId           = appID;
     FacebookSdk.AutoLogAppEventsEnabled = false;
     FacebookSdk.SdkInitialize(Forms.Context.ApplicationContext);
     CallbackManager = CallbackManagerFactory.Create();
     LoginManager.Instance.RegisterCallback(CallbackManager, this);
     LoginManager.Instance.SetLoginBehavior(LoginBehavior.WebOnly);
 }
Beispiel #23
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            _clientManager = new ClientManager(new StitchClient(
                                                   this,
                                                   "test-uybga"
                                                   ));

            var providersResult =
                await _clientManager.StitchClient.GetAuthProviders();

            if (!providersResult.IsSuccessful)
            {
                Log.Error(Tag,
                          "Error getting auth info: {0}",
                          providersResult.Error);
                return;
            }

            if (_clientManager.StitchClient.IsAuthenticated())
            {
                InitTodoView();
                return;
            }

            var availableProviders = providersResult.Value;

            FacebookSdk.ApplicationId =
                availableProviders.FacebookProviderInfo?.AppId ?? "INVALID";

#pragma warning disable 0618
            FacebookSdk.SdkInitialize(this);
#pragma warning restore 0618

            SetContentView(Resource.Layout.ActivityMain);

            if (availableProviders.HasAnonymousProviderInfo)
            {
                var loginButton = FindViewById(Resource.Id.anonymous_login_button);

                loginButton.Click += async delegate
                {
                    var authResult = await this._clientManager
                                     .StitchClient
                                     .Login(new AnonymousAuthProvider());

                    if (authResult.IsSuccessful)
                    {
                        InitTodoView();
                    }
                };

                loginButton.Visibility = ViewStates.Visible;
            }
        }
Beispiel #24
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            FacebookSdk.SdkInitialize(this);
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
Beispiel #25
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FacebookSdk.SdkInitialize(Application.Context);
            callbackManager = CallbackManagerFactory.Create();
            LoginManager.Instance.RegisterCallback(callbackManager, this);

            SetContentView(Resource.Layout.Login);
        }
Beispiel #26
0
 protected override void OnCreate(Bundle bundle)
 {
     Instance = this;
     base.OnCreate(bundle);
     FacebookSdk.SdkInitialize(this);
     CallbackManager = CallbackManagerFactory.Create();
     TheGame         = new HappinessAndroidGame();
     SetContentView((View)TheGame.Services.GetService(typeof(View)));
     TheGame.Run();
 }
Beispiel #27
0
        public void SetupFacebook()
        {
            FacebookSdk.SdkInitialize(this.ApplicationContext);
            callback = CallbackManagerFactory.Create();
            LoginManager.Instance.RegisterCallback(callback, this);

            mProfileTracker = new MyProfileTracker();
            mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged;
            mProfileTracker.StartTracking();
        }
Beispiel #28
0
        private void InitializeComponents()
        {
            try
            {
                progress_bar = FindViewById <ProgressBar>(Resource.Id.progress_bar_login);

                btn_login_facebook = FindViewById <Button>(Resource.Id.btn_login_facebook);

                btn_login_facebook.SetOnClickListener(this);

                FacebookSdk.SdkInitialize(ApplicationContext);

                callbackManager = CallbackManagerFactory.Create();

                graphCallback = new GraphJSONObjectCallback
                {
                    HandleSuccess = email =>
                    {
                        LoginWithFacebook(Profile.CurrentProfile, email);
                    }
                };

                loginCallback = new FacebookCallback <LoginResult>
                {
                    HandleSuccess = loginResult =>
                    {
                        var request = GraphRequest.NewMeRequest(loginResult.AccessToken, graphCallback);

                        Bundle parameters = new Bundle();

                        parameters.PutString("fields", "id, name, email");

                        request.Parameters = parameters;

                        request.ExecuteAsync();
                    },
                    HandleCancel = () =>
                    {
                        StopLoading();
                    },
                    HandleError = loginError =>
                    {
                        StopLoading();
                    }
                };

                Xamarin.Facebook.Login.LoginManager.Instance.RegisterCallback(callbackManager, loginCallback);

                CheckUserLogged();
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
        private void ConfigureFacebookSignIn()
        {
            FacebookSdk.SdkInitialize(this.ApplicationContext);

            LoginButton fblogin = FindViewById <LoginButton>(Resource.Id.btnFBLogin);

            fblogin.SetReadPermissions("email", "public_profile");

            mCallbackManager = CallbackManagerFactory.Create();
            fblogin.RegisterCallback(mCallbackManager, this);
        }
Beispiel #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FacebookSdk.SdkInitialize(this.ApplicationContext);

            _callBackManager = CallbackManagerFactory.Create();
            SetLoginButton();

            LoginManager.Instance.RegisterCallback(_callBackManager, this);
        }