This repository provides an example on how to create a Watch app with .NET MAUI and link it to your mobile app.
Author: Damian Suess
Website: SuessLabs.com
Submitted with ❤ by Xeno Innovations, Inc. and Suess Labs.
The projects disable ImplicitUsings
so that you can clearly see which libraries and namespaces need to be included for each class.
- .NET MAUI v8
- Android Wear API 34
- Wearable - Getting Started Debugging
- Learn.MauiWatch.MobileApp - All-in-one Mobile and Wear apps
- Status: In-progress
- Features: Watch to App communication
- Packages:
Xamarin.GooglePlayServices.Wearable
- Learn.MauiWatch.Wearable - Xamarin.Android based Wear app
- Status: Done
- Features: UI Only
- Learn.MauiWatch.WearMaui - .NET MAUI UI exclusive UI
- Status: Done - UI Only
- Features: UI Only
Place your watch into Developer mode by performing the following:
- Go to System -> About Watch -> Software Information
- Tap the "Software version" section 7 times.
For the MAUI Android Wear app, you don't have to do much to get it up and running. Notice, we didn't event need to add to the AndroidManifest.xml
file, <uses-feature android:name="android.hardware.type.watch" />
.
To perform communications you can choose between WiFi or Bluetooth. The more common being, Bluetooth for communication between the app and wearable.
NuGet Packages:
Xamarin.GooglePlayServices.Wearable
AndroidManifest.xml Permissions:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
- This app requires the package,
Xamarin.GooglePlayServices.Wearable
v118.x. The first iteration will use this version.- As of version v119.x,
MessageOptions
class is no longer available; no documentation either.com/google/android/gms/wearable/MessageClient
- The (lack of) documentation suggests Wearable.WearableOptions
- See also from, developers.google.com:
- As of version v119.x,
Type androidx.collection.ArrayMapKt is defined multiple times:
C:\Users\USERNAME\.nuget\packages\xamarin.androidx.collection.jvm\1.4.0.4\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class,
C:\Users\USERNAME\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class
Note, the following versions for xamarin.androidx.collection
are in conflict. We need force Kotlin (ktx
) to use the same version as JVM.
- JVM: 1.4.0.4
- KTX: 1.2.0.9
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx">
<Version>1.4.0.4</Version>
</PackageReference>
- AndroidX.Collection.ArrayMapKt is defined multiple times (GitHub - MAUI: #18665)
- Java linking conflict when adding Xamarin.AndroidX... (GitHub - MAUI: 26963)
- Recommendation: Upgrade to .NET 9
- Workaround (GitHub - Android-Libraries: #764)
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android34.0'">
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="121.0.1.4" />
<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.8.1.1" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.1.1" />
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.6.2.1" />
</ItemGroup>
Official Guides:
Around the Internet:
- Showcase-1 Showcase-2
- Dimmer-MAUI App - Wear
- Parse-LiveQueries comms.
- MAUI with Watch Apps
- Link Emulators - Watch and Mobile
You'll need Android Wear OS or Samsung's installed on your emulator to communicate between the two as per, linking emulators - Watch and Mobile.
You can get Android Wear OS from APK Mirror and upload it to the mobile emulator via:
adb install name_of_the_file.apk
Want to install other APKs like Wear OS on your emulator without logging into Google Play Store? The Aurora store app can help with that.