Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Wearable DataClient GetFdForAsset not fully implemented #838

Open
vouksh opened this issue Feb 14, 2024 · 2 comments
Open

Wearable DataClient GetFdForAsset not fully implemented #838

vouksh opened this issue Feb 14, 2024 · 2 comments

Comments

@vouksh
Copy link

vouksh commented Feb 14, 2024

Xamarin.Android Version (eg: 6.0):

.NET Maui 8.0.6

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

Windows 11

Google Play Services Version

118.2.0.5

  • [] GPS-FB with AndroidX dependencies (versions 1xx.yyyy.zz)
    GooglePlayServices.Wearable 118.1.0.2

Describe your Issue

I'm developing an app that uses Maui for the Phone app (the app works with iOS as well) that communicates with a Watch app written in Kotlin.
The Watch app gathers data and I want to transfer it to the phone, and due to the size of the files being > 100kb, I need to write them into an Asset package.
However, I run into difficulty doing so on the Phone side.
The method GetFdForAsset(Asset) in the DataClient lacks an awaitable version, and the method currently implemented does return anything usable. I'm not completely sure what the equivalent would be.

For now the deprecated WearableClass.DataApi.GetFdForAssetAsync() method works, but I'd rather not continue using a deprecated method.

If needed, I can try to assemble a demo project, but it would take some time to strip the apps down.

Relevant information

Add relevant project settings from *.csproj file:

Packages used:

	<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
		<PackageReference Include="Xamarin.GooglePlayServices.Wearable">
			<Version>118.1.0.2</Version>
		</PackageReference>
	</ItemGroup>

Build settings (tools)

		<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>Enable</Nullable>

		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">31.0</SupportedOSPlatformVersion>

NOTE: Please DO NOT submit screenshot images. Images are not searchable!

Minimal Repro Code Sample

This code currently works and is roughly how I would expect the new API to work.

IDataApiGetFdForAssetResult fd = await WearableClass.DataApi.GetFdForAssetAsync(_dataClient.AsGoogleApiClient(), asset);
using var assetStream = File.OpenWrite(rawDataPath);
fd.InputStream.CopyTo(assetStream);
var len = assetStream.Length;
assetStream.Close();

If you want to speed up investigation and bug fixing: please provide minimal repro sample for tests.

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

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

@moljac
Copy link
Member

moljac commented Apr 30, 2024

@vouksh

Thanks for the feedback and sorry for late response

If needed, I can try to assemble a demo project, but it would take some time to strip the apps down.

That would be great, because I am not SDK expert. I need to see what is missing.

@vouksh
Copy link
Author

vouksh commented Aug 15, 2024

Sorry for taking so long to reply, I've been focused on the iOS release of our app and haven't had time to revisit the Android side.

I was able to get the "proper" method to work, but it takes a little more code and might be able to be simplified on the library side
using var fd = _dataClient.GetFdForAsset(asset).GetAwaiter<DataClient.GetFdForAssetResponse>().GetResult();
this is how I'm currently using it, but ideally it should just be
using var fd = await _dataClient.GetFdForAsset(asset);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants