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 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 savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); mprofileTracker = new MyProfileTracker(); mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mprofileTracker.StartTracking(); SetContentView(Resource.Layout.Loginfrm); FirebaseApp.InitializeApp(this); try { if (FirebaseInstanceId.Instance.Token.ToString() != "") { InstanceToken = FirebaseInstanceId.Instance.Token.ToString(); } else { OnResume(); } } catch { } //BtnFBLogin = FindViewById<LoginButton>(Resource.Id.btnFacebook); btnLogInWithEmail = FindViewById <Button>(Resource.Id.btnLogin); lblOrRegisterHere = FindViewById <TextView>(Resource.Id.lblOrRegisterHere); txtLoginUserName = FindViewById <EditText>(Resource.Id.txtUsername); txtLoginUserPassword = FindViewById <EditText>(Resource.Id.txtUserPassword); btnLogInWithEmail.Click += BtnLogInWithEmail_Click; lblOrRegisterHere.Click += LblOrRegisterHere_Click; //BtnFBLogin.SetReadPermissions(new List<string> { "user_friends", "public_profile", "email", "user_birthday" }); mFBCallManager = CallbackManagerFactory.Create(); //BtnFBLogin.RegisterCallback(mFBCallManager, this); var requiredPermissions = new String[] { Manifest.Permission.Internet, Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage, Manifest.Permission.Camera, Manifest.Permission.ReadContacts }; ActivityCompat.RequestPermissions(this, requiredPermissions, REQUEST_LOCATION); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); FacebookSdk.SdkInitialize(ApplicationContext); SetContentView(Resource.Layout.Login); btnTentarNovamente.Click += btnTentarNovamente_Click; try { profileTracker = new MyProfileTracker(); profileTracker.OnProfileChanged += profileChanged; profileTracker.StartTracking(); //btnFacebook.Visibility = Android.Views.ViewStates.Visible; btnFacebook.SetReadPermissions("public_profile", "email", "user_friends"); callBackMgr = CallbackManagerFactory.Create(); btnFacebook.RegisterCallback(callBackMgr, this); if (AccessToken.CurrentAccessToken != null && Profile.CurrentProfile != null) { await Conectar(Profile.CurrentProfile); } else { btnFacebook.Visibility = Android.Views.ViewStates.Visible; /* Profile profile = new Profile("100000568434728", "ss", "dd", "s", "das", null); * Conectar(profile); * return;*/ } } catch (System.Exception ex) { if (btnFacebook.Visibility != ViewStates.Visible) { btnTentarNovamente.Visibility = ViewStates.Visible; } SetProgressBarVisibility(false); DroidUtils.MostraMensagem("Problemas ao tentar se conectar, verifique sua internet e tente novamente.", ex.Message); } }
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); SetContentView(Resource.Layout.LoginActivity); mprofileTracker = new MyProfileTracker(); mprofileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mprofileTracker.StartTracking(); // Create your application here mContext = this; Firebase.FirebaseApp.InitializeApp(this); var signedIn = FirebaseAuth.Instance.CurrentUser; if (signedIn == null) { //Toast.MakeText(this, "User Not Signed in", ToastLength.Short).Show(); } else { } TextView txtLogin = FindViewById <TextView>(Resource.Id.txtLogin); TextView txtRegister = FindViewById <TextView>(Resource.Id.txtRegister); TextView txtGoogleLogin = FindViewById <TextView>(Resource.Id.txtLoginGoogle); txtLogin.Click += moveToEmailLogin; txtRegister.Click += moveToRegister; //facebook //var BtnFBLogin = FindViewById<LoginButton>(Resource.Id.txtLoginFacebook); //BtnFBLogin.SetReadPermissions(new List<string> { //"user_friends", // "public_profile", // "email" // }); //mFBCallManager = CallbackManagerFactory.Create(); //BtnFBLogin.RegisterCallback(mFBCallManager, this); mFBCallManager = CallbackManagerFactory.Create(); LoginManager.Instance.RegisterCallback(mFBCallManager, this); facebookButton = FindViewById <TextView>(Resource.Id.txtLoginFacebook); facebookButton.Click += OnFacebookButtonClick; LoginManager.Instance.LogOut(); }
protected override void OnCreate(Bundle bundle) { //NOTE*** you have decodebitmapfromstream and decoderesource and decodebytearray //def don't need them all base.OnCreate(bundle); //problem getting view to load with fb login button //make fresh activity and try copying xml and code there. //async it's another activity we shouldnt get the bother from fb login through a dialog' FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mBtnSignIn = FindViewById <Button>(Resource.Id.btnSignIn); mTxtImgChoiceInfo = FindViewById <TextView>(Resource.Id.txtOr); mBtnSignup = FindViewById <Button>(Resource.Id.btnSignUp); mProgressBar = FindViewById <ProgressBar>(Resource.Id.progressBar1); mTxtBase64String = FindViewById <TextView>(Resource.Id.txtViewImgBase64); mImgUploadedPhoto = FindViewById <ImageView>(Resource.Id.imgUploadedPhoto); mTxtTestCross = FindViewById <TextView>(Resource.Id.txtImgPath); mBtnOpenGallery = FindViewById <Button>(Resource.Id.btnOpenGallery); mBtnConverttoBase = FindViewById <Button>(Resource.Id.btnConverttoBase64); mBtnConverttoImg = FindViewById <Button>(Resource.Id.btnConverttoImg); mTblImgStrings = FindViewById <TableLayout>(Resource.Id.tblBaseStrings); mBtnGetEmail = FindViewById <Button>(Resource.Id.btnGetEmail); //string[] mImgBaseStrings = new string[] { }; //List<string> mImgBaseStrings = new List<string>(); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); mProfilePic = FindViewById <ProfilePictureView>(Resource.Id.profilePicMain); mBtnFbLogin = FindViewById <LoginButton>(Resource.Id.btnFbLoginMain); mTest = FindViewById <TextView>(Resource.Id.txtTest); mBtnFbLogin.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); mBtnFbLogin.RegisterCallback(mCallBackManager, this); mBtnGetEmail.Click += (o, e) => { System.Diagnostics.Debug.Write("welllllllllllllllll"); GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }; mBtnSignIn.Click += (object sender, EventArgs e) => { //pull up dialog //finish matching up login dialog, some of the code here is to do with signup as its copied from elsewhere FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialogue_Login signInDialog = new dialogue_Login(); signInDialog.Show(transaction, "dialog fragment"); signInDialog.mOnLoginComplete += SignInDialog_mOnSignInComplete; System.Diagnostics.Debug.Write("BTN SIGNIN CLICKED"); //Went with a fully-fledged function(name on line above) as it'd be quite a bit to write inside of a lambda expression //signInDialog.mOnLoginComplete += (object theSender, OnLoginEventArgs e) => //{ //} }; mBtnSignup.Click += (object sender, EventArgs e) => { //pull up dialog //this is used to pull up the dialog from the activity FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialogue_SignUp signUpDialog = new dialogue_SignUp(); signUpDialog.Show(transaction, "dialog fragment"); //signUpDialog.mOnSignUpComplete += signUpDialog_mOnSignUpComplete; signUpDialog.mOnSignUpComplete += SignUpDialog_mOnSignUpComplete; }; mBtnOpenGallery.Click += delegate { var imageIntent = new Intent(); imageIntent.SetType("image/*"); imageIntent.SetAction(Intent.ActionGetContent); StartActivityForResult( Intent.CreateChooser(imageIntent, "Select photo"), 0); }; mBtnConverttoBase.Click += MBtnConverttoBase_Click; mBtnConverttoImg.Click += MBtnConverttoImg_Click; mImgUploadedPhoto.Click += (object sender, EventArgs e) => { Bitmap bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.mail4_small); //Convert to byte array MemoryStream memStream = new MemoryStream(); bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, memStream); byte[] byteArray = memStream.ToArray(); var intent = new Intent(this, typeof(FullscreenImage)); intent.SetType("image/*"); intent.SetAction(Intent.ActionGetContent); intent.PutExtra("MyImg", byteArray); StartActivity(intent); }; }