xamarin / GooglePlayServicesComponents

Other
313 stars 145 forks source link

ActivityRecognitionClient no longer accessible #834

Closed pierre-galaup closed 2 months ago

pierre-galaup commented 5 months ago

Xamarin.Android Version (eg: 6.0):

All

Operating System & Version (eg: Mac OSX 10.11):

All

Google Play Services Version

Xamarin.GooglePlayServices.Location >= 121.0.1

Describe your Issue

Hello,

Since version 121.0.1 of Xamarin.GooglePlayServices.Location, we no longer have access to the ActivityRecognitionClient.

Is there a new way to use the ActivityRecognitionClient?

I've attached a project that works in 120.0.0.2 but no longer in 121.0.1 or higher.

Thank you

Relevant information

Add relevant project settings from *.csproj file:

Packages used:

        <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
        <PackageReference Include="Xamarin.GooglePlayServices.Location" Version="121.0.1.4" />

Minimal Repro Code Sample

ActivityRecognitionClientSample.zip

Steps to Reproduce (with link to sample solution if possible):

Open the solution. Solution does not build.

Include any relevant Exception Stack traces, build logs, adb logs:

moljac commented 2 months ago
generated/com.google.android.gms.play-services-location/obj/Release/net7.0-android/generated/src/Android.Gms.Location.IActivityRecognitionClient.cs
generated/com.google.android.gms.play-services-location/obj/Release/net6.0-android/generated/src/Android.Gms.Location.IActivityRecognitionClient.cs
generated/com.google.android.gms.play-services-location/obj/Release/monoandroid12.0/generated/src/Android.Gms.Location.IActivityRecognitionClient.cs
    public partial interface IActivityRecognitionClient : global::Android.Gms.Common.Apis.IHasApiKey {

ActivityRecognitionClient is interface now and not recommended anymore.

Activity Recognition Transition API The Transition API is the preferred way of using Activity Recognition because it improves accuracy, consumes less power, and enhances engineering productivity. It is suitable for all use cases and developers get notified when a user activity has changed.

https://developers.google.com/android/reference/com/google/android/gms/location/ActivityRecognitionClient