protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_login); this.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); this.Window.ClearFlags(WindowManagerFlags.TranslucentStatus); this.Window.SetStatusBarColor(Color.ParseColor("#204060")); progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); googlebutton = FindViewById <Button>(Resource.Id.googlebutton); googlebutton.Click += Googlebutton_Click; facebookbutton = FindViewById <Button>(Resource.Id.facebookbutton); facebookbutton.Click += Facebookbutton_Click; fb_dummybuttton = FindViewById <LoginButton>(Resource.Id.fb_dummybuttton); fb_dummybuttton.SetReadPermissions(new List <string> { "public_profile", "email" }); callbackManager = CallbackManagerFactory.Create(); fb_dummybuttton.RegisterCallback(callbackManager, this); gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn).RequestIdToken("787402240794-prndui4ntngl1je2lglu46lev1esogsi.apps.googleusercontent.com") .RequestEmail().Build(); googleApiClient = new GoogleApiClient.Builder(this).AddApi(Auth.GOOGLE_SIGN_IN_API, gso).Build(); googleApiClient.Connect(); firebaseAuth = AppDataHelper.GetFirebaseAuth(); prefs = PreferenceManager.GetDefaultSharedPreferences(this); AppDataHelper.editor = prefs.Edit(); }
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); }
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); }
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); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.login_activity); //return base.OnOptionsItemSelected(item); FirebaseApp.InitializeApp(this); _auth = FirebaseAuth.Instance; GoogleButton = FindViewById <SignInButton>(Resource.Id.gButton); GoogleButton.Click += (object sender, System.EventArgs e) => { var signGoogleintent = Auth.GoogleSignInApi.GetSignInIntent(_googleApiClient); StartActivityForResult(signGoogleintent, Constants.ActionResult.GoogleLoginResul); }; FacebookButton = FindViewById <LoginButton>(Resource.Id.fButton); FacebookButton.SetReadPermissions("email", "public_profile"); callbackManager = CallbackManagerFactory.Create(); FacebookButton.RegisterCallback(callbackManager, this); _googleApiClient = LoginHelper.ConfigureGoogleSignIn(this); }
private void botonFB(object sender, EventArgs e) { btnFacebook.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); btnFacebook.RegisterCallback(mCallBackManager, this); }
private void InitSocialLogins() { try { //#Facebook if (AppSettings.ShowFacebookLogin) { //FacebookSdk.SdkInitialize(this); ProfileTracker = new FbMyProfileTracker(); ProfileTracker.MOnProfileChanged += ProfileTrackerOnMOnProfileChanged; ProfileTracker.StartTracking(); BtnFbLogin = FindViewById <LoginButton>(Resource.Id.fblogin_button); BtnFbLogin.Visibility = ViewStates.Visible; BtnFbLogin.SetPermissions(new List <string> { "email", "public_profile" }); MFbCallManager = CallbackManagerFactory.Create(); BtnFbLogin.RegisterCallback(MFbCallManager, this); //FB accessToken var accessToken = AccessToken.CurrentAccessToken; var isLoggedIn = accessToken != null && !accessToken.IsExpired; if (isLoggedIn && Profile.CurrentProfile != null) { LoginManager.Instance.LogOut(); } string hash = Methods.App.GetKeyHashesConfigured(this); Console.WriteLine(hash); } else { BtnFbLogin = FindViewById <LoginButton>(Resource.Id.fblogin_button); BtnFbLogin.Visibility = ViewStates.Gone; } //#Google if (AppSettings.ShowGoogleLogin) { MGoogleSignIn = FindViewById <Button>(Resource.Id.Googlelogin_button); MGoogleSignIn.Click += GoogleSignInButtonOnClick; } else { MGoogleSignIn = FindViewById <Button>(Resource.Id.Googlelogin_button); MGoogleSignIn.Visibility = ViewStates.Gone; } } catch (Exception e) { Console.WriteLine(e); } }
public FacebookLoginService() { loginButton = new LoginButton(MainActivity.Activity); loginButton.SetPermissions(new List <string>() { "public_profile", "email" }); loginButton.RegisterCallback(MainActivity.Activity.CallbackManager, this); }
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); }
private void ConfigurateFacebookData() { GraphRequest oGraphRequest = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,birthday,email,address"); oGraphRequest.Parameters = parameters; oGraphRequest.ExecuteAsync(); oICallbackManager = CallbackManagerFactory.Create(); btnLogin.RegisterCallback(oICallbackManager, this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SimpleStorage.SetContext(ApplicationContext); // Create your application here string token = StorageUtils <String> .GetPreferencesValue(DroidConstant.CurrentUser); if (token != null && token.Length > 0) { StartActivity(typeof(MainActivity)); Finish(); } FacebookSdk.SdkInitialize(this.ApplicationContext); SetContentView(Resource.Layout.activity_login); //#region PushNotification //if (Intent.Extras != null) //{ // foreach (var key in Intent.Extras.KeySet()) // { // var value = Intent.Extras.GetString(key); // Log.Debug("TAG", "Key: {0} Value: {1}", key, value); // } //} //#endregion _ILoginService = new LoginService(); InitilizeView(); AppUtils.generateKeyHash(this); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); button = FindViewById <LoginButton>(Resource.Id.login_button); button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); mGoogleApiClient = new GoogleApiClient.Builder(this) .AddConnectionCallbacks(this) .AddOnConnectionFailedListener(this) .AddApi(PlusClass.API) .AddScope(new Scope(Scopes.Profile)) .Build(); }
private void SetLoginButton() { LoginButton button = new LoginButton(this); button.SetReadPermissions(ConstantHelper.permissions); button.RegisterCallback(_callBackManager, this); if (FacebookProfileHelper.IsRegistred()) { SendRequest(); } button.CallOnClick(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.FacebookLogin); facebookLoginButton = (LoginButton)FindViewById(Resource.Id.loginButton); facebookLoginButton.SetReadPermissions(new List <string> { "public_profile", "email" }); callbackManager = CallbackManagerFactory.Create(); facebookLoginButton.RegisterCallback(callbackManager, this); profileTracker = new FacebookProfileTracker(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(Context); View view = inflater.Inflate(Resource.Layout.FacebookLogin, container, false); // view.FindViewById<LoginButton>(Resource.Id.login_button); callbackManager = CallbackManagerFactory.Create(); loginButton = view.FindViewById <LoginButton>(Resource.Id.login_button); loginButton.RegisterCallback(callbackManager, this); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Initializes the sdk face FacebookSdk.SdkInitialize(this.ApplicationContext); //PackageInfo oPackageInfo = this.PackageManager.GetPackageInfo("com.facebook.FacebookActivity", PackageInfoFlags.Signatures); //foreach (Android.Content.PM.Signature oSignature in oPackageInfo.Signatures) //{ // MessageDigest oMessageDigest = MessageDigest.GetInstance("SHA"); // oMessageDigest.Update(oSignature.ToByteArray()); // string keyHash = Convert.ToBase64String(oMessageDigest.Digest()); // Console.WriteLine("KeyHash:", keyHash); //} //Initializes the Profile Tracker service oFacebookService = new FacebookService(); oFacebookService.mOnProfileChanged += OFacebookService_mOnProfileChanged; oFacebookService.StartTracking(); //Set Content view SetContentView(Resource.Layout.FacebookLogin); btnLogin = FindViewById <LoginButton>(Resource.Id.fblogin); txtFirstName = FindViewById <TextView>(Resource.Id.TxtFirstname); txtLastName = FindViewById <TextView>(Resource.Id.TxtLastName); txtName = FindViewById <TextView>(Resource.Id.TxtName); pictureView = FindViewById <ProfilePictureView>(Resource.Id.ImgPro); btnLogin.Click += (o, e) => { if (AccessToken.CurrentAccessToken != null && Profile.CurrentProfile != null) { //send this info to the other page } else { btnLogin.SetReadPermissions(new List <string> { "user_friends", "public_profile" }); oICallbackManager = CallbackManagerFactory.Create(); btnLogin.RegisterCallback(oICallbackManager, this); } }; }
public Facebook() { mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); LoginButton btnFacebook = FindViewById <LoginButton>(Resource.Id.login_button); btnFacebook.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); btnFacebook.RegisterCallback(mCallBackManager, this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += MProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); SetContentView(Resource.Layout.Main); Button faceBookButton = FindViewById <Button>(Resource.Id.button); mTxtFirstName = FindViewById <TextView>(Resource.Id.txtFirstName); mTxtLastName = FindViewById <TextView>(Resource.Id.txtLastName); mTxtName = FindViewById <TextView>(Resource.Id.txtName); mProfilePic = FindViewById <ProfilePictureView>(Resource.Id.profilePic); mBtnShared = FindViewById <ShareButton>(Resource.Id.btnShare); mBtnGetEmail = FindViewById <Button>(Resource.Id.btnGetEmail); LoginButton button = FindViewById <LoginButton>(Resource.Id.login_button); button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); mBtnGetEmail.Click += (o, e) => { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }; ShareLinkContent content = new ShareLinkContent.Builder().Build(); mBtnShared.ShareContent = content; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); usernameText = (TextView)FindViewById(Resource.Id.usernameText); emailText = (TextView)FindViewById(Resource.Id.emailText); facebookLoginButton = (LoginButton)FindViewById(Resource.Id.loginButton); facebookLoginButton.SetReadPermissions(new List <string> { "public_profile", "email" }); callBackManager = CallbackManagerFactory.Create(); facebookLoginButton.RegisterCallback(callBackManager, this); firebaseAuth = GetFirebaseAuth(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); LoginButton button = FindViewById <LoginButton>(Resource.Id.login_button); button.SetReadPermissions("user_friends"); mCallbackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallbackManager, this); announcements = new List <Announcement>();; Button buttonGetRecords = FindViewById <Button>(Resource.Id.button1); Button buttonGetRecord2 = FindViewById <Button>(Resource.Id.button2); ListView boomsView = FindViewById <ListView>(Resource.Id.listView1); buttonGetRecords.Click += (sender, args) => { for (int i = 0; i < 5; i++) { announcements.Add(new Announcement { UserPost = $"boom{i}", UserIcon = GetImageBitmapFromUrl(friendsList[0].picture), PostedPicture = Resources.GetDrawable(Resource.Drawable.parrots) }); } adapter = new AnnouncemenAdapter(this, announcements); boomsView.Adapter = adapter; }; buttonGetRecord2.Click += (sender, args) => { GetUserFrinds(); }; }
private void SetupFacebookLogin() { callbackManager = CallbackManagerFactory.Create(); facebookLoginBtn = FindViewById <LoginButton>(Resource.Id.facebookLoginBtn); facebookLoginBtn.SetReadPermissions("public_profile", "email"); var loginCallback = new FacebookCallback <LoginResult> { HandleSuccess = async loginResult => { progress.ShowProgressDialog("Trwa logowanie w aplikacji... Proszê czekaæ"); var token = await LoginWithFacebook(); if (token != null) { progress.CloseProgressDialog(); if (token.UserHasToSetNickName) { GoToActivity(new Intent(this, typeof(StartActivity))); } else { SetUserNameInAppSettings(token.UserName); GoToActivity(new Intent(this, typeof(MainActivity))); } } else { progress.CloseProgressDialog(); AlertsService.ShowLongToast(this, "Facebook zwróci³ token, ale coœ posz³o nie tak z logowaniem na serwerze"); } }, HandleCancel = () => { progress.CloseProgressDialog(); AlertsService.ShowLongToast(this, "Przerwano logowanie z facebookiem"); }, HandleError = loginError => { progress.CloseProgressDialog(); AlertsService.ShowLongToast(this, "Wyst¹pi³ b³¹d podczas logowania z facebookiem"); } }; facebookLoginBtn.RegisterCallback(this.callbackManager, loginCallback); }
private void SetUI() { mCallBackManager = CallbackManagerFactory.Create(); btnfb = FindViewById <Button>(Resource.Id.btnfb); btnfb.Click += delegate { loginBtn.PerformClick(); loginBtn.SetReadPermissions(new List <string>() { "email", "public_profile", "user_friends", "user_about_me" }); }; loginBtn = FindViewById <LoginButton>(Resource.Id.btnFacebook); loginBtn.RegisterCallback(mCallBackManager, this); btnGoogle = FindViewById <Button>(Resource.Id.btnGoogle); btnGoogle.Click += BtnGoogle_Click; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); // Create your application here SetContentView(Resource.Layout.layout3); FirebaseApp.InitializeApp(this); mAuth = FirebaseAuth.Instance; LoginButton fblogin = FindViewById <LoginButton>(Resource.Id.fblogin); fblogin.SetReadPermissions("email", "public_profile"); mCallbackManager = CallbackManagerFactory.Create(); fblogin.RegisterCallback(mCallbackManager, this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.login); if (IsLoggedIn()) { Intent i = new Intent(this, typeof(MainActivity)); StartActivity(i); } else { LoginButton loginButton = FindViewById <LoginButton>(Resource.Id.login_button); loginButton.SetReadPermissions("user_friends", "public_profile"); mCallBackManager = CallbackManagerFactory.Create(); loginButton.RegisterCallback(mCallBackManager, this); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); core = new LoginCore(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Facebook mprofileTracker = new MyProfileTracker(); mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mprofileTracker.StartTracking(); BtnFBLogin = FindViewById <LoginButton>(Resource.Id.fblogin); BtnFBLogin.SetReadPermissions(new List <string> { "user_friends", "public_profile", "email" }); mFBCallManager = CallbackManagerFactory.Create(); BtnFBLogin.RegisterCallback(mFBCallManager, this); //Crear Cuenta crear_cuenta = FindViewById <Button>(Resource.Id.crear_cuenta); crear_cuenta.Click += delegate { Crear_cuenta(); }; //iniciar sesion iniciar_sesion = FindViewById <Button>(Resource.Id.iniciar_sesion); iniciar_sesion.Click += delegate { Iniciar_sesion(); }; //Hash PackageInfo info = this.PackageManager.GetPackageInfo("com.smartapptech.Boss_Mandados", 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); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.first_page); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen); loginButton = FindViewById <Button>(Resource.Id.LoginButton); loginButton.Click += GoToLoginPage; signupButton = FindViewById <Button>(Resource.Id.SignupButton); signupButton.Click += GoToSignupPage; FacebookButton = FindViewById <LoginButton>(Resource.Id.FacebookLoginButton); CallbackManager = CallbackManagerFactory.Create(); FacebookButton.RegisterCallback(CallbackManager, this); FacebookProgressBar = FindViewById <ProgressBar>(Resource.Id.indeterminateBar); FacebookProgressBar.Visibility = ViewStates.Invisible; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FacebookSdk.SdkInitialize(this.ApplicationContext); mprofileTracker = new MyProfileTracker(); mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mprofileTracker.StartTracking(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.login); 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); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); //We start tracking the profile to capture if it changes mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChange += mProfileTracker_MOnProfileChange; mProfileTracker.StartTracking(); SetContentView(Resource.Layout.LoginPage); if (AccessToken.CurrentAccessToken != null) { StartActivity(typeof(Activity2)); } LoginButton button = FindViewById <LoginButton> (Resource.Id.login_button); //Activate what fields we want to retrieve in the facebook developer page button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); //Request from the user the parameters using the graph API from facebook. /*GraphRequest request = GraphRequest.NewMeRequest (AccessToken.CurrentAccessToken, (Xamarin.Facebook.GraphRequest.IGraphJSONObjectCallback)(this)); * Bundle bundle = new Bundle (); * bundle.PutString ("fields", "id,name,email,last_name"); * request.Parameters = bundle; * request.ExecuteAsync ();*/ mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (AccessToken.CurrentAccessToken != null && Profile.CurrentProfile != null) { SwitchToMainActivity(LoginType.Facebook); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_login); LoginButton login = FindViewById <LoginButton>(Resource.Id.login_facebook_button); manager = CallbackManagerFactory.Create(); login.RegisterCallback(manager, this); register = FindViewById <Button>(Resource.Id.Register); register.Click += delegate { Intent intent = new Intent(this, typeof(RegisterActivity)); StartActivity(intent); }; ///Can be used to generate a key hash //PackageInfo info = this.PackageManager.GetPackageInfo("com.report.kontrole.AvoidATicket", 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: {0}", keyhash); //} }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MetricsManager.Register(Application); HockeyLog.LogLevel = 3; SupportActionBar.SetDisplayHomeAsUpEnabled(false); Title = ViewModel.Title; _profileTracker = new MyProfileTracker(); _profileTracker.ProfileChanged += MyProfileTracker_ProfileChanged; _profileTracker.StartTracking(); _loginButton = FindViewById <LoginButton>(Resource.Id.fblogin); _callbackManager = CallbackManagerFactory.Create(); _loginButton.RegisterCallback(_callbackManager, this); if (Profile.CurrentProfile != null) { LoginByFacebook(); return; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here FacebookSdk.SdkInitialize(this.ApplicationContext); SetContentView(Resource.Layout.activity_facebook); // Views mStatusTextView = FindViewById <TextView>(Resource.Id.status); mDetailTextView = FindViewById <TextView>(Resource.Id.detail); // Button listeners FirebaseApp.InitializeApp(this); mAuth = FirebaseAuth.Instance; LoginButton fblogin = FindViewById <LoginButton>(Resource.Id.button_facebook_login); fblogin.Click += delegate { mCallbackManager = CallbackManagerFactory.Create(); fblogin.RegisterCallback(mCallbackManager, this); }; FindViewById(Resource.Id.button_facebook_signout).Click += delegate { SignOut(); }; }