cannot convert from 'Android.Content.Context' to 'Android.App.Activity'

abvabv USMember ✭✭✭

Hi, I'm implementing authentication in a Xamarin.Forms app by using https://developer.xamarin.com/guides/xamarin-forms/cloud-services/authentication/oauth/ and my OAuthLoginPresenter is like
public class OAuthLoginPresenter
{
public void Login(Authenticator authenticator)
{
Xamarin.Forms.Forms.Context.StartActivity(authenticator.GetUI(Xamarin.Forms.Forms.Context));
}
}
it is showing cannot convert from 'Android.Content.Context' to 'Android.App.Activity' error.Help me for solving this.
Thnak you.

Best Answer

  • abvabv US ✭✭✭
    Accepted Answer

    @akash After changing xamarin.auth version 1.4.1 to 1.3.2.1 it is working fine.

Answers

  • DK90DK90 USMember ✭✭✭

    @AshokVeldi.1634 Xamarin.Forms.Forms.Context as Activity

  • abvabv USMember ✭✭✭

    Hi @DK90 sorry I didn’t get you.

  • DK90DK90 USMember ✭✭✭
    var activity = Xamarin.Forms.Forms.Context as Activity;
    activity.StartActivity(authenticator.GetUI(activity));
    

    @Ashok.Veldi This should work

  • abvabv USMember ✭✭✭
    edited April 2017

    @DK90 now it is showing cannot convert from 'object' to 'Android.Content.Intent'

  • abvabv USMember ✭✭✭
    edited April 2017

    Please help me to solve this error.

  • akashakash USMember ✭✭

    Any update on this?

  • abvabv USMember ✭✭✭
    Accepted Answer

    @akash After changing xamarin.auth version 1.4.1 to 1.3.2.1 it is working fine.

  • akashakash USMember ✭✭

    I just tried using alpha release of 1.5... and it works fine with IOS, android still gives issue. Now stuck with Google embed request issue! Any clue on that?

  • moljacmoljac HRBeta ✭✭✭

    @akash

    Now stuck with Google embed request issue! Any clue on that?

    Most likely if I could parse "Now stuck with Google embed request issue!"

Sign In or Register to comment.