Get started Chronoir_net.Chronica.AndroidWithWear


For building Android mobile and wear application in C# with Xamarin

1. Welcome!

Thank you for using Chronoir_net.Chronica.AndroidWithWear!
This multi-project for building apps for Android (API level 19 or higher) and Android Wear 2.0 (API level 25 or higher) with Xamarin.Android.
This contains shared projects, and source code can be shared between projects.

* Project template info.

Project template name Chronoir_net.Chronica.AndroidWithWear
Displayed name Android with Wear 2.0 App (Shared Project)
Project template version 1.0.1
Programing language C# 6.0
Target Android Version (Mobile) 4.4 (KitKat / API level 19) or higher
Target Android Version (Wear) Wear 2.0 (Android 7.1 Nougat / API level 25) or higher

2. System requirements

This project corresponds to the development environment shown below.

* Development environment (for Windows)

Name Version
Visual Studio Community 2017 or higher
Xamarin.Android (Recommended the latest version)
Xamarin for Visual Studio (Recommended the latest version)

* Development environment (for Mac)

Name Version
Visual Studio for Mac Community 2017 or higher
Xamarin.Android (Recommended the latest version)
 

* Android SDK (For Wear)

Launch the Android SDK Manager and install or update the Android SDK and Tools as necessary.

Note: For Mobile, install target version SDK as necessary.

SDK name API Level / Version
Android SDK Platform API Level 25
Android SDK Platform Tools Ver. 25 or higher
 

* NuGet packages (For Wear)

Launch the NuGet package manager and install or update the packages as necessary.

Package name Version
Xamarin.Android.Support.Annotations 25.x.x.x
Xamarin.Android.Support.Compat 25.x.x.x
Xamarin.Android.Support.Core.UI 25.x.x.x
Xamarin.Android.Support.Fragment 25.x.x.x
Xamarin.Android.Support.Media.Compat 25.x.x.x
Xamarin.Android.Support.Percent 25.x.x.x
Xamarin.Android.Support.v4 25.x.x.x
Xamarin.Android.Support.v13 25.x.x.x
Xamarin.Android.Support.v7.RecyclerView 25.x.x.x
Xamarin.Android.Wear 2.0.x.x

3. Contents

The files included in this project template shown below.

* Shared project ($safeprojectname$)

This project is referenced by 'Mobile' and 'Wearable' projects.

Name Summary
$safeprojectname$.shproj Project file
$safeprojectname$.projitems Project item list
TrialCounter.cs Sample class file

* Mobile project ($safeprojectname$.Mobile)

Name Summary
$safeprojectname$.Mobile.csproj Project file
MainActivity.cs Main activity source file
Properties/AndroidManifest.xml Android application manifest file
Resources/drawable/Icon.png Icon file
Resources/layout/Main.xml Main layout definition file
Resources/values/string.xml Dimention size value definition file
Resources/Resource.designer.cs Resource ID definition file
(Note: Please do not edit directly.)

* Wearable project ($safeprojectname$.Wear)

Name Summary
$safeprojectname$.Wear.csproj Project file
MainActivity.cs Main activity source file
Properties/AndroidManifest.xml Android application manifest file
Resources/drawable/Icon.png Icon file
Resources/layout/Main.xml Main layout definition file
Resources/values/string.xml Dimention string value definition file
Resources/values/dimens.xml Dimention size value definition file
Resources/values-round/string.xml Dimention string value definition file for Round Form
packages.config Definition file for installation information of NuGet package
(Note: Please do not edit directly.)
Resources/Resource.designer.cs Resource ID definition file
(Note: Please do not edit directly.)

4. Running or Debugging

To run and debug the application, prepair an emulator or actual device.

* Emulator

Launch the Android SDK Manager and install the system image of the emulator as necessary.

Name API Level
Intel x86 Atom System Image API Level 19 or higher
Android Wear Intel x86 Atom System Image API Level 25 or higher

Note: To use the system image of Intel x86, install "Intel x86 Emulator Accelerator (HAXM install)".

5. Tips

Writing Mobile or Wear specific code in the shared project.

To write mobile code or wear code in a shared project, use #if directive and conditional compilation symbols.
ANDROID_APP symbol for Mobile and ANDROID_WEAR_APP symbol for Wear are defined.

// Shared code.
 
#if ANDROID_APP
 
	// Mobile specific code.
	 
#elif ANDROID_WEAR_APP
 
	// Wear specific code.
	 
#endif
 
// Shared code.