Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dotnet/android-samples
A collection of .NET for Android sample projects
https://github.com/dotnet/android-samples
Last synced: about 1 month ago
JSON representation
A collection of .NET for Android sample projects
- Host: GitHub
- URL: https://github.com/dotnet/android-samples
- Owner: dotnet
- License: mit
- Created: 2010-08-16T16:08:19.000Z (over 14 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T19:48:00.000Z (5 months ago)
- Last Synced: 2024-07-01T00:08:34.268Z (5 months ago)
- Language: C#
- Homepage: https://dotnet.microsoft.com/apps/mobile
- Size: 328 MB
- Stars: 2,205
- Watchers: 417
- Forks: 4,062
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
Awesome Lists containing this project
README
# .NET for Android samples
This repository contains .NET for Android samples, showing usage of various
Android API wrappers from C#. Visit the [Android Sample Gallery](https://docs.microsoft.com/samples/browse/?term=dotnet-android)
to download individual samples.See the [.NET MAUI Installation docs](https://docs.microsoft.com/en-us/dotnet/maui/get-started/installation) for setup instructions.
## Galleries
We love samples! Application samples show off our platform and provide a great way for people to learn our stuff. And we even promote them as a first-class feature of the docs site. You can find the sample galleries here:
- [MAUI Samples](https://learn.microsoft.com/samples/browse/?term=maui)
- [Android Samples](https://docs.microsoft.com/samples/browse/?term=dotnet-android)
## Sample Requirements
We welcome sample submissions, please start by creating an issue with your proposal.
Because the sample galleries are powered by the github sample repos, each sample needs to have the following things:
- **Screenshots** - a folder called Screenshots that has at least one screen shot of the sample on each platform (preferably a screen shot for every page or every major piece of functionality). For an example of this, see [android-p/AndroidPMiniDemo](https://github.com/xamarin/monodroid-samples/tree/master/android-p/AndroidPMiniDemo/Screenshots).
- **Readme** - a `README.md` file that explains the sample, and contains metadata to help customers find it. For an example of this, see [android-p/AndroidPMiniDemo](https://github.com/xamarin/monodroid-samples/blob/master/android-p/AndroidPMiniDemo/README.md). The README file should begin with a YAML header (delimited by `---`) with the following keys/values:
- **name** - must begin with `.NET for Android -`
- **description** - brief description of the sample (< 150 chars) that appears in the sample code browser search
- **page_type** - must be the string `sample`.
- **languages** - coding language/s used in the sample, such as: `csharp`, `fsharp`, `vb`, `java`
- **products**: should be `dotnet-android` for every sample in this repo
- **urlFragment**: although this can be auto-generated, please supply an all-lowercase value that represents the sample's path in this repo, except directory separators are replaced with dashes (`-`) and no other punctuation.
Here is a working example from [_android-p/AndroidPMiniDemo_ README raw view](https://raw.githubusercontent.com/xamarin/monodroid-samples/master/android-p/AndroidPMiniDemo/README.md).
```yaml
---
name: .NET for Android - Android P Mini Demo
description: "Demonstrates new display cutout and image notification features (Android Pie)"
page_type: sample
languages:
- csharp
products:
- dotnet-android
urlFragment: android-p-androidpminidemo
---
# Heading 1rest of README goes here, including screenshot images and requirements/instructions to get it running
```> NOTE: This must be valid YAML, so some characters in the name or description will require the entire string to be surrounded by " or ' quotes.
- **Buildable solution and .csproj file** - the project _must_ build and have the appropriate project scaffolding (solution + .csproj files).
This approach ensures that all samples integrate with the Microsoft [sample code browser](https://learn.microsoft.com/samples/browse/?term=dotnet-android).
## Tips for .NET Migration
The goal here is to fully "modernize" the template for .NET and C# 11.
Compare a `dotnet new android` template named the same as the existing project.
1. If the root namespace doesn't match the project name, to get the
existing code to compile, you may need:```xml
Xamarin.AidlDemo
```2. Update any dependencies, NuGet packages, etc.
3. Remove `android:versionCode`, `android:versionName`, `package`,
``, and `Xamarin.AidlDemo```
2. Update any dependencies, NuGet packages, etc.
3. Remove android:versionCode, android:versionName, package,
, and