protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.login_layout); communicationService = new CommunicationService(); username = FindViewById <TextInputEditText>(Resource.Id.name_edit_text); password = FindViewById <TextInputEditText>(Resource.Id.pass_edit_text); loginButton = FindViewById <Button>(Resource.Id.buttonLogin); loginButton.Click += LoginButton_Click; loginProggresBar = FindViewById <ProgressBar>(Resource.Id.progressBarLogin); ConfigurationManager.Initialize(new AndroidConfigurationStreamProviderFactory(() => this)); await communicationService.Initialize(); var token = CredentialsHelper.GetToken(); var expiration = CredentialsHelper.GetExpiration(); if (!token.Equals("none") && !expiration.Equals("none")) { if (DateTime.Now < DateTime.Parse(expiration)) { StartActivity(typeof(MainActivity)); } } }