Xamarin.Android 9.0.0.19
Windows 10
15.0.1
FirebaseInstanceId.Instance.GetInstanceId() should return a Task
@jahmai can you please provide a sample project to demostrate the issues that you are having.
Regards
@newky2k I'd rather not have to set up a Google Firebase account to demonstrate the issue (and not going to use my apps official keys). But it's easily observed from the code:
Here is the official docs:
public Task<InstanceIdResult> getInstanceId ()
Here is the signature in the binding signature:
[Register("getInstanceId", "()Lcom/google/android/gms/tasks/Task;", "GetGetInstanceIdHandler")]
public virtual unsafe Task GetInstanceId()
{
return Java.Lang.Object.GetObject<Task>(FirebaseInstanceId._members.InstanceMethods.InvokeVirtualObjectMethod("getInstanceId.()Lcom/google/android/gms/tasks/Task;", (IJavaPeerable) this, (JniArgumentValue*) null).Handle, JniHandleOwnership.TransferLocalRef);
}
You should just be able to use JavaCast<T>() in this case and it should _just work_....
Will be fixed in a future release. For now, please use JavaCast to the correct type.
@Redth Shouldn't I just use https://github.com/xamarin/GooglePlayServicesComponents/commit/b66274669ba729ac80181daf646ec571aee97c04 ?
Of course, if you want to build from source otherwise you'll have to wait for a new nuget release
I'll just make it an extension method. Cheers.
Do you have updates?
As I can see in the latest Firebase.Messaging v71.1740.0 package provides only Task GetInstanceId()
@wcoder You can just do:
GetInstanceId ().AsAsync<IInstanceIdResult> ()
When I wait on GetInstanceId().AsAsync
Most helpful comment
@wcoder You can just do:
GetInstanceId ().AsAsync<IInstanceIdResult> ()