xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
173 stars 42 forks source link

Bind "androidx.credentials" #815

Closed Kebechet closed 5 months ago

Kebechet commented 7 months ago

Description

Please bind https://developer.android.com/jetpack/androidx/releases/credentials

it contains a new flow to simplify auth.

moljac commented 7 months ago

@Kebechet

Thanks for the feedback, but seems like it will need some new dependency packages from com.google.android.libraries.*. So, it is not trivial as I thought.

Kebechet commented 7 months ago

Hello @moljac thank you for the info. So what is the current plan ? You will work on it but it will take much longer ? Or are you going to postpone it because of the new dependency ?

moljac commented 7 months ago

thank you for the info.

You are welcome.

So what is the current plan ?

Don't know. I have to make it.

You will work on it but it will take much longer ?

Really don't know.

Or are you going to postpone it because of the new dependency ?

Postpone - yes, but for how long. I don't know. I will do my best to be ASAP.

moljac commented 6 months ago

In progress:

https://github.com/xamarin/AndroidX/pull/823

https://github.com/xamarin/AndroidX/pull/828

These bindings were hell on earth. 2 packages 3 PRs and still not done.

mpbw2 commented 6 months ago

I'm unable to extend AndroidX.Credentials.Provider.CredentialProviderService using the current 1.2.0 release in nuget. Not sure if I'm doing something wrong or if that falls under 'still not done' since androidx.credentials.provider.CredentialProviderService is available in a native java project.

moljac commented 6 months ago

I'm unable to extend AndroidX.Credentials.Provider.CredentialProviderService using the current 1.2.0 release in nuget.

It was not surfaced. I need to check.

Not sure if I'm doing something wrong or if that falls under 'still not done' since androidx.credentials.provider.CredentialProviderService is available in a native java project.

Notes:

build (class-parse errors):

obj/Debug/net6.0-android/api.xml.class-parse : warning BG8605: The Java type 'android.service.credentials.CredentialProviderService' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) [/Users/Shared/Projects/d/X/AX/mu-20231212-credentials/generated/androidx.credentials.credentials/androidx.credentials.credentials.csproj::TargetFramework=net6.0-android]
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.509/tools/Xamarin.Android.Bindings.ClassParse.targets(36,5): obj/Debug/net6.0-android/api.xml.class-parse warning BG8605: The Java type 'android.service.credentials.CredentialProviderService' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) [/Users/Shared/Projects/d/X/AX/mu-20231212-credentials/generated/androidx.credentials.credentials/androidx.credentials.credentials.csproj::TargetFramework=net6.0-android]

android.service.credentials.CredentialProviderService is API 34.

api.xml.class-parse

    <class
      abstract="true"
      deprecated="not deprecated"
      jni-extends="Landroid/service/credentials/CredentialProviderService;"
      extends="android.service.credentials.CredentialProviderService"
      extends-generic-aware="android.service.credentials.CredentialProviderService"
      final="false"
      name="CredentialProviderService"
      jni-signature="Landroidx/credentials/provider/CredentialProviderService;"
      source-file-name="CredentialProviderService.kt"
      static="false"
      visibility="public">
</class>
moljac commented 5 months ago

Happy New Year

Finished bindings

https://www.nuget.org/packages?q=androidx.credentials

... together with few more...

closing this issue

mpbw2 commented 5 months ago

@moljac Should the updates be live by now? There doesn't appear to be any movement on nuget.org and re-downloading yields the same result (CredentialProviderService still missing)

Kebechet commented 4 months ago

Ticket: https://github.com/xamarin/AndroidX/issues/840

Hello @moljac I am trying to wrap androidx.credentials into separate nuget to simplify the usage but in methods _credentialManager.ClearCredentialState or _credentialManager.ClearCredentialStateAsync I get a runtime exception:

[CredManProvService] In CredentialProviderFrameworkImpl onClearCredential
[Binder] Caught a RuntimeException from the binder stub implementation.
[Binder] java.lang.NullPointerException: Parameter specified as non-null is null: method androidx.credentials.CredentialProviderFrameworkImpl$onClearCredential$outcome$1.onResult, parameter response
[Binder]    at androidx.credentials.CredentialProviderFrameworkImpl$onClearCredential$outcome$1.onResult(Unknown Source:3)
[Binder]    at androidx.credentials.CredentialProviderFrameworkImpl$onClearCredential$outcome$1.onResult(CredentialProviderFrameworkImpl.kt:367)
[Binder]    at android.credentials.CredentialManager$ClearCredentialStateTransport.onSuccess(CredentialManager.java:775)
[Binder]    at android.credentials.IClearCredentialStateCallback$Stub.onTransact(IClearCredentialStateCallback.java:95)
[Binder]    at android.os.Binder.execTransactInternal(Binder.java:1363)
[Binder]    at android.os.Binder.execTransact(Binder.java:1304)

Is it problem in my code or it is possible that there is something with the binding ?

moljac commented 4 months ago

@Kebechet Not sure. I am not expert for ALL APIs in AX and GPS-FB-MLKit.

I would need a repro sample in order to make statement.

Kebechet commented 4 months ago

Thanks for the reply. The error is in the android library itself. More info in the ticket: https://github.com/xamarin/AndroidX/issues/840

vladPanasiuk commented 2 months ago

Any news? AndroidX.Credentials.Provider.CredentialProviderService is still unavailable in latest nuget

moljac commented 2 months ago

Any news? AndroidX.Credentials.Provider.CredentialProviderService is still unavailable in latest nuget

It is available, but it is available in API34 and abstract, so you need to inherit from it and implement what is necesssary.

vladPanasiuk commented 2 months ago

image @moljac As you can see it is still unavailable. My target api is 34.

vladPanasiuk commented 1 month ago

@moljac Can you confirm that it is bug in Nuget package or my project is wrong configured?

vladPanasiuk commented 1 month ago

@moljac still waiting answer