xamarin / AndroidSupportComponents

Xamarin bindings for Android Support libraries - For AndroidX see https://github.com/xamarin/AndroidX
MIT License
146 stars 56 forks source link

WorkManager - missing getWorkInfosForUniqueWork #233

Closed todorspetkov closed 4 years ago

todorspetkov commented 4 years ago

Xamarin.Android Version (eg: 6.0):

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

Support Libraries Version (eg: 23.3.0):

Describe your Issue:

Why is getWorkInfosForUniqueWork missing in bindings?

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

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

moljac commented 4 years ago

@todorspetkov

A little bit more info perhaps? Nuget version, etc.

todorspetkov commented 4 years ago

Hi, sorry. Here you go: Target Android Version : 10 (API level 29) Operating System & Version : Mac Mojave 10.14.6 Support Libraries Version : 28.0.0.3 WorkManager nuget version : Xamarin.Android.Arch.Work.Runtime 1.0.0.3 Describe your Issue: When writing native java code for Android we used the method getWorkInfosForUniqueWork to obtains status of already scheduled work. This method is not present in the Xamarin Android bindings for the library. We tried to use the method GetWorkInfosForUniqueWorkLiveData but when we try to extract the WorkInfo list from it the result is always null. Here is how we use the live data method : LiveData statuses = AndroidX.Work.WorkManager.Instance.GetWorkInfosForUniqueWorkLiveData(JOB_TAG); JavaList workInfoList = statuses.Value.JavaCast<JavaList>();

Since in Android native java we used getWorkInfosForUniqueWork I was wondering why this method is not mapped in the bindings... Otherwise is there a blocking call that we can make to get scheduled jobe WorkInfo? Thanks, Tod

moljac commented 4 years ago

@todorspetkov Seems like this is AndrodiX:

LiveData statuses = AndroidX.Work.WorkManager.Instance.GetWorkInfosForUniqueWorkLiveData(JOB_TAG);
JavaList<AndroidX.Work.WorkInfo> workInfoList = statuses.Value.JavaCast<JavaList<AndroidX.Work.WorkInfo>>();

Please close this issue here and reopen it in AndroidX.

it has generic return type and thus it was not surfaced.

todorspetkov commented 4 years ago

Closing. Will move to AndroidX.

LorenzoAlfaro commented 4 years ago

Closing. Will move to AndroidX.

Where can I follow this issue?

todorspetkov commented 4 years ago

AndroidX already exposes GetWorkInfosForUniqueWork and so there is nothing to follow. As I understood it if one wants to use these calls one has to migrate the whole project to AndroidX...